Configuration
OWA can be configured in a variety of ways to meet the needs of your application(s).
owa-config.php
is OWA's main configuration file. This file can be created manually prior to an installation by simply copying owa-config-dist.php
to owa-config.php
in the same directory.
This configuration file is where OWA gets information about the database that it should connect to as well as a few other global configuration settings.
The following convenience constants are included in your config file and should be used to setup certain aspects of your OWA instance.
Constant | Description |
---|---|
OWA_DB_HOST | This is the hostname where your database can be accessed. This could be a remote host such as db.yourdomain.com or, if OWA is running on the same host as your database instance you can use localhost . |
OWA_DB_NAME | This is the name of the database that OWA should read and write to. This database needs to be created if it does not exist prior to starting the install. |
OWA_DB_USER | This is the user name that OWA will use to connect to your database server. This database user name must have permission to read and write to the database that you want OWA to use. |
OWA_DB_PASSWORD | This is the password of the database user. |
OWA_DB_PORT | This is the port of the database server. |
OWA_PUBLIC_URL | This is the web URL of OWA's base directory. This value must always end with a "/" (e.g. http://yourdomain/path/to/owa/). |
OWA_ERROR_HANDLER | This setting controls which of OWA's error handlers should be used. This value defaults to "production". Set this to "development" if you are trying to [[Debugging |
OWA_LOG_PHP_ERRORS | This will log all of PHP's errors/notices to OWA's debug log file. This is handy for [[Debugging |
OWA_CACHE_OBJECTS | This settings turns on and off OWA's object caching system. |
The configuration file also contains a several secret keys used for authenticating API and web requests. These keys are generated by the install wizard. These keys should remain secret at all times! However, if you ever feel need to change them, use the reset-secrets CLI command.
Key/Salt | Description |
---|---|
OWA_NONCE_KEY | Secret key used to authenticate "nonce" values passed along with POST requests |
OWA_NONCE_SALT | Salt used to generate the nonce |
OWA_AUTH_KEY | Secret key used to authenticate signed API requests. |
OWA_AUTH_SALT | Salt used to generate API keys |
You can alter the configuration settings of any module from within the owa-config.php
file using the $this->set()
method. This method takes the name of the module that houses the setting your wish to change, the key (or name) of the setting, and the value you wish to change it to.
For example:
$this->set('base, 'mailer-from', 'owa@myinstance.com');
OWA makes use of the popular PHPMailer library to send mail. PHPmailer will use the default Mail transfer Agent (MTA) defined in your php.ini file unless you specify an alternate. You can tell phphmailer to use a different MTA by adding the following config values to owa-config.php
file.
$this->set( 'base', 'mailer-host', 'your host');
$this->set( 'base', 'mailer-port', 'your port');
$this->set( 'base', 'mailer-use-smtp', true);
$this->set( 'base', 'mailer-smtpAuth', true);
$this->set( 'base', 'mailer-username', 'your user name');
$this->set( 'base', 'mailer-password', 'your password');
Note: see the PHPMailer documentation for what these config values mean.
The default values for the base module's configuration settings are located in the following file: modules/base/classes/settings.php
Alternatively, modules may implement their own settings admin interface pages. These admin pages can be accessed from within the OWA admin interface and configuration values set using them take precedence over any similar values defined in your config file.
All of OWA's settings can be accessed and changed using the API methods owa_coreAPI::getSetting()
and owa_coreAPI::setSetting()
methods.
owa_coreAPI::setSetting('modulename', 'somesetting', 'somevalue');
If you need to persist a setting to the database use the owa_coreAPI::persistSetting()
method like so:
owa_coreAPI::persistSetting('modulename', 'somesetting', 'somevaluetobestored');
In addition to the these convenience methods, you can also access settings via OWA's global configuration object like so:
// fetch the global config object
$config = owa_coreAPI::configSingleton();
// get a setting
$setting = $config->get('somemodule', 'somesetting');
// change a setting (just for the current PHP process)
$config->set('somemodule', 'somesetting', 'newvalue');
// change a setting and store it to the database
$config->persistSetting('somemodule', 'somesetting', 'newvalue');
$config->save();