Especially for a future development we prepare a configuration through a configuration file. Because Haskell/Scotty does not provided any prepared mechanism for it we had to implemented it by my own. Currently there are 2 files -
build-info.cfg which contain all information needed by a running application. For tests there exist special versions suffixed by
-test. A format of configuration files is an old-style
Windows .INI format.
An advantage of an external configuration is that the configuration do not have to be present during a compilation process and it can be attached later (during a start of the application).
A build configuration (
build-info.cfg file) contains information about the last build of the application. This configuration can be created simply by running a prepared script
build-info.sh. Normally this script is run by a CI Tool (Travis CI) during build process.
name = Data Stewardship Wizard Serverversion = 1.0.0builtat = 2017/10/25 19:50:20Z
Application Configuration (
app-config.cfg file) contains 4 sections -
Role. Currently there are not many things which can be configured but it is assumed that it will grow in the future.
Web section we can configure on which port the server will be running.
Database section we can set up connection properties to our database.
JWT section contains property which holds a value of secret which is need in a process of signing JWT payload.
Role section we can assign permissions to roles. These sets of permissions will be used as templates for new users in a way that when a new user is created with some role he will get assigned a list of permissions based on this template from the configuration file.
[Environment]# Production / Staging / Development / Testenv = Production[Client]address = http://localhost:3001[Web]port = 3000[Database]host = mongodbname = dsw-serverport = 27017authenabled = falseusername =password =[JWT]secret =version = 1expiration = 14[Role]defaultrole = DATASTEWARDadmin = UM_PERM, ORG_PERM, KM_PERM, KM_UPGRADE_PERM, KM_PUBLISH_PERM, PM_READ_PERM, PM_WRITE_PERM, QTN_PERM, DMP_PERMdatasteward = KM_PERM, KM_UPGRADE_PERM, KM_PUBLISH_PERM, PM_READ_PERM, PM_WRITE_PERM, QTN_PERM, DMP_PERMresearcher = PM_READ_PERM, QTN_PERM, DMP_PERM[Mail]enabled = falsename =email =host =username =password =[Analytics]enabled = falseemail =[Feedback]token =owner =repo =issueurl = https://github.com/:owner/:dsw-staging/issues/:issueId
When running the DSW Client, you have to set environment variable
API_URL which should contain absolute URL to the API backend (DSW server) without the trailing slash.