okta / samples-nodejs-express-4

Express 4 samples. Will publish an artifact that can be consumed by end-to-end sample repos
Other
120 stars 118 forks source link

Use environment vars w/ optional dotenv file in shared samples config #69

Closed aarongranick-okta closed 5 years ago

aarongranick-okta commented 5 years ago

Solves many issues caused by config variables persisted. On a clean install these vars can (are) set by running the tests with environment vars. This allows our CI environment to install and test using only environment variables. However, on the next run the values stored in the config will be used instead of environment variables. This is frustrating and confusing to the local developer, if they expect to use environment variables. The frustration is compounded because resource-server from this repo is used by other samples in their testing. So failure to respect environment vars from the shell causes these other sample projects to attempt editing of the resource-server's config file! A much simpler solution is for the projects in this repo to always respect environment variables.

This PR removes the idea of .samples.config.json and replaces it with a new file config.js which uses variables from process.env. They must be defined in the shell as env vars or persisted in a single file: testenv