cablelabs / lpwanserver

LPWAN Provisioning & Management Server
https://lpwanserver.com
Apache License 2.0
37 stars 11 forks source link

Refactor app configuration #257

Closed rhythnic closed 5 years ago

rhythnic commented 5 years ago

Use JSON Schema for config file

Replace .hjson with a JSON-schema. JSON-schema will allow for defining defaults as well as adding descriptions of the variables. Users can use a CONFIG environment variable to specify a JSON file with values. If no file is specified, the app will use all the defaults. If a file is specified, the app will use those values along with defaults for any missing values.

Build app config object

  1. Environment variables that match the names of config properties.
  2. Values from the JSON file pointed to by the CONFIG environment variable.
  3. Defaults from the JSON schema.

The resulting object should be validated using a JSON schema validator.

Replace config references in the codebase