Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CORS_ENABLED env var for docker-compose #620

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Set Nodejs 14 as minimum version in packages.json (effectively removing Nodev12 from supported versions)
- Add: CORS_ENABLED env var (boolean) to enable the cors configuration (of config.js file) in your docker image (#608)
1 change: 1 addition & 0 deletions doc/manuals/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ The environment variables accepted by the script (for which there exists counter
- `PROOF_OF_LIFE_INTERVAL`: The time in seconds between proof of life logging messages informing that the server is up
and running normally. Default value: "60". `PROCESSED_REQUEST_LOG_STATISTICS_INTERVAL`: The time in seconds between
processed requests statistics appear in the logs. Default value: "60".
- `CORS_ENABLED`: Boolean attribute (`true`|`false`) to enable cors configuration. Optional. Default value: "false".

For example, to start the STH server listening on port 7777, connecting to a MongoDB instance listening on
mymongo.com:27777 and without filtering out the empty results, use:
Expand Down
5 changes: 4 additions & 1 deletion lib/configuration/sthConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ if (ENV.STH_PORT && !isNaN(ENV.STH_PORT)) {
);
}

if (config && config.cors && config.cors.enabled) {
if (ENV.CORS_ENABLED && !(ENV.CORS_ENABLED == null)) {
module.exports.corsEnabled = JSON.parse(ENV.CORS_ENABLED);
sthLogger.info(module.exports.LOGGING_CONTEXT.STARTUP, 'CORS value set to: ' + module.exports.corsEnabled);
} else if (config && config.cors && config.cors.enabled) {
module.exports.corsEnabled = JSON.parse(config.cors.enabled);
sthLogger.info(module.exports.LOGGING_CONTEXT.STARTUP, 'CORS value set to: ' + module.exports.corsEnabled);
} else {
Expand Down
Loading