-
Notifications
You must be signed in to change notification settings - Fork 42
Config file
Matthew Bourque edited this page Apr 10, 2018
·
7 revisions
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 utils
subpackage in individual clones of the jwql
repository. This can be achieved by the following:
- If necessary, clone your fork of the
jwql
repository withgit clone [email protected]:username/jwql.git
(see the installation instructions for further details. - Navigate to the
utils/
directory - Create the config file using
touch config.json
, or alternatively, retrieve the officialjwql
config file from the home directory of thejwql
admin account on thejwql
virtual machine.
The format of the config file should be in JSON
format, for example:
{
"my_key" : "my_val",
"some_other_key" : "some_other_val"
}
These data can be accessed in a jwql
script via the utils.py
module as such:
from jwql.utils.utils import get_config
settings = get_config()
my_key = settings['my_key']
In this case, settings
is a python dict
containing the key/value pairs stored in the config.json
file.