-
Notifications
You must be signed in to change notification settings - Fork 42
Config file
In order to avoid hard coding commonly used data, or data that may be a security risk (such as filepaths, instrument configurations, etc.), the jwql
application employs a configuration file to store such information. The jwql
code expects this config file to be named config.json
, and to be placed within the main directory in individual clones of the jwql
repository. This can be achieved by the following:
- If you have not yet done so, install the
jwql
package. See the installation instructions for further details. - Determine the installation location of the package. You can do this through Python via:
import jwql
print(jwql.__path__)
- Navigate to the
jwql/
directory of where the package is installed. - A file called
example_config.json
already exists. It is named as such to help avoid accidentally committing a complete configuration file with sensitive information to the repository. Make a copy of this calledconfig.json
and save the file. The file should look like the template below.
{
"admin_account" : "",
"auth_mast" : "",
"client_id" : "",
"client_secret" : "",
"connection_string" : "",
"database" : {
"engine" : "",
"name" : "",
"user" : "",
"password" : "",
"host" : "",
"port" : ""
},
"jwql_dir" : "",
"jwql_version": "",
"server_type": "",
"log_dir" : "",
"mast_token" : "",
"outputs" : "",
"preview_image_filesystem" : "",
"filesystem" : "",
"setup_file" : "",
"test_data" : "",
"test_dir" : "",
"thumbnail_filesystem" : "",
"cores" : ""
}
Since some of these data contain sensitive information, we do not provide the actual values here. Please ask a JWQL team member or email [email protected] if you need assistance filling out the template.
These data can be accessed in a jwql
script via the utils.py
module, for example:
from jwql.utils.utils import get_config
settings = get_config()
connection_string = settings['connection_string']
In this case, settings
is a python dict
containing the key/value pairs stored in the config.json
file.