src/backend/doc/services/config.md
To locate your configuration file, see Configuring Puter.
Service configuration appears under the "services" property in the
configuration file for Puter. If Puter's configuration had no other
values except for a service config with one key, it might look like
this:
{
"services": {
"my-service": {
"somekey": "some value"
}
}
}
Services have their configuration object assigned to this.config.
class MyService extends BaseService {
async _init () {
// You can access configuration for a service like this
this.log.info('value of my key is: ' + this.config.somekey);
}
}
Services can access global configuration. This can be useful for knowing how Puter itself is configured, but using this global config object for service configuration is discouraged as it could create conflicts between services.
class MyService extends BaseService {
async _init () {
// You can access configuration for a service like this
this.log.info('Puter is hosted on: ' + this.global_config.domain);
}
}