Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- added configuration via environment variables to Dockerfile
- amended authors list on container metadata
- amended envsubst command to include all environment variables
- extended config-local.js to include the majority of configuration options available in app.js
- Added comment to app.js to remind future contributors to add configuration to Dockerfile and config-local.js
  • Loading branch information
qcaas-nhs-sjt committed Mar 8, 2024
1 parent dd9e49e commit d8a1e26
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com
org.opencontainers.image.authors=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com
org.opencontainers.image.authors=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com, Shaun Turner <[email protected]>
org.opencontainers.image.vendor=OHDSI
# If the image was pushed, we need to pull it again to inspect it
Expand Down
96 changes: 93 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,106 @@ RUN find . -type f "(" \
FROM docker.io/nginxinc/nginx-unprivileged:1.23.3-alpine@sha256:c748ba587e7436aaa8729b64d4e0412410a486f0c592f0eec100fb3804ff9afd

LABEL org.opencontainers.image.title="OHDSI-Atlas"
LABEL org.opencontainers.image.authors="Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com"
LABEL org.opencontainers.image.authors="Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com, Shaun Turner<[email protected]>"
LABEL org.opencontainers.image.description="ATLAS is an open source software tool for researchers to \
conduct scientific analyses on standardized observational data"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.vendor="OHDSI"
LABEL org.opencontainers.image.source="https://github.com/OHDSI/Atlas"

# URL where WebAPI can be queried by the client
ENV WEBAPI_URL=http://localhost:8080/WebAPI/ \
CONFIG_PATH=/etc/atlas/config-local.js
ENV USE_DYNAMIC_WEBAPI_URL="false"
ENV DYNAMIC_WEBAPI_SUFFIX="/WebAPI/"
ENV WEBAPI_URL="http://localhost:8080/WebAPI/"
ENV CONFIG_PATH="/etc/atlas/config-local.js"
ENV APP_NAME="OHDSI"
ENV COHORT_COMPARISON_RESULTS="false"
ENV USER_AUTHENTICATION="false"
ENV PLP_RESULTS="false"
ENV CLEAR_LOCAL_STORAGE="false"
ENV DISABLE_BROWSER_CHECK="false"
ENV ENABLE_PERMISSIONS_MGMT="true"
ENV CACHE_SOURCES="false"
ENV POLL_INTERVAL="60000"
ENV SKIP_LOGIN="false"
ENV USE_EXECUTION_ENGINE="false"
ENV VIEW_PROFILE_DATES="false"
ENV ENABLE_COSTS="false"
ENV SUPPORT_URL="https://github.com/ohdsi/atlas/issues"
ENV SUPPORT_MAIL="[email protected]"
ENV FEEDBACK_CONTACTS="For access or questions concerning the Atlas application please contact:"
ENV FEEDBACK_HTML=""
ENV COMPANYINFO_HTML=""
ENV COMPANYINFO_SHOW="true"
ENV DEFAULT_LOCALE="en"

ENV WIN_PROVIDER_ENABLED="false"
ENV WIN_PROVIDER_NAME="Windows"
ENV WIN_PROVIDER_URL="user/login/windows"
ENV WIN_PROVIDER_AJAX="true"
ENV WIN_PROVIDER_ICON="fab fa-windows"

ENV KERB_PROVIDER_ENABLED="false"
ENV KERB_PROVIDER_NAME="Kerberos"
ENV KERB_PROVIDER_URL="user/login/kerberos"
ENV KERB_PROVIDER_AJAX="true"
ENV KERB_PROVIDER_ICON="fab fa-windows"

ENV OID_PROVIDER_ENABLED="false"
ENV OID_PROVIDER_NAME="OpenID Connect"
ENV OID_PROVIDER_URL="user/login/openid"
ENV OID_PROVIDER_AJAX="false"
ENV OID_PROVIDER_ICON="fa fa-openid"

ENV GGL_PROVIDER_ENABLED="false"
ENV GGL_PROVIDER_NAME="Google"
ENV GGL_PROVIDER_URL="user/oauth/google"
ENV GGL_PROVIDER_AJAX="false"
ENV GGL_PROVIDER_ICON="fab fa-google"

ENV FB_PROVIDER_ENABLED="false"
ENV FB_PROVIDER_NAME="Facebook"
ENV FB_PROVIDER_URL="user/oauth/facebook"
ENV FB_PROVIDER_AJAX="false"
ENV FB_PROVIDER_ICON="fab fa-facebook-f"

ENV GH_PROVIDER_ENABLED="false"
ENV GH_PROVIDER_NAME="Github"
ENV GH_PROVIDER_URL="user/oauth/github"
ENV GH_PROVIDER_AJAX="false"
ENV GH_PROVIDER_ICON="fab fa-github"

ENV DB_PROVIDER_ENABLED="false"
ENV DB_PROVIDER_NAME="DB"
ENV DB_PROVIDER_URL="user/login/db"
ENV DB_PROVIDER_AJAX="true"
ENV DB_PROVIDER_ICON="fa fa-database"
ENV DB_PROVIDER_CREDFORM="true"

ENV LDAP_PROVIDER_ENABLED="false"
ENV LDAP_PROVIDER_NAME="LDAP"
ENV LDAP_PROVIDER_URL="user/login/ldap"
ENV LDAP_PROVIDER_AJAX="true"
ENV LDAP_PROVIDER_ICON="fa fa-cubes"
ENV LDAP_PROVIDER_CREDFORM="true"

ENV SAML_PROVIDER_ENABLED="false"
ENV SAML_PROVIDER_NAME="SAML"
ENV SAML_PROVIDER_URL="user/login/saml"
ENV SAML_PROVIDER_AJAX="false"
ENV SAML_PROVIDER_ICON="fab fa-openid"

ENV AD_PROVIDER_ENABLED="false"
ENV AD_PROVIDER_NAME="Active Directory LDAP"
ENV AD_PROVIDER_URL="user/login/ad"
ENV AD_PROVIDER_AJAX="true"
ENV AD_PROVIDER_ICON="fa fa-cubes"
ENV AD_PROVIDER_CREDFORM="true"

ENV ENABLE_TANDCS="true"
ENV ENABLE_PERSONCOUNT="true"
ENV ENABLE_TAGGING_SECTION="false"
ENV REFRESH_TOKEN_THRESHOLD="240"

# Configure webserver
COPY ./docker/nginx-default.conf /etc/nginx/conf.d/default.conf
Expand Down
2 changes: 1 addition & 1 deletion docker/30-atlas-env-subst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [ -n "${WEBAPI_URL}" ]; then
TFILE=`mktemp`
trap "rm -f $TFILE" 0 1 2 3 15
# Don't copy but rewrite so that permissions are not changed.
envsubst '$WEBAPI_URL' < "$CONFIG_TARGET_PATH" > "$TFILE"
envsubst < "$CONFIG_TARGET_PATH" > "$TFILE"
cat "$TFILE" > "$CONFIG_TARGET_PATH"
rm -f "$TFILE"
fi
126 changes: 121 additions & 5 deletions docker/config-local.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,131 @@
define([], function () {
var configLocal = {};

if ("${CLEAR_LOCAL_STORAGE}" == "true") {
localStorage.clear();
}

var webapi_url = "${WEBAPI_URL}";

if ("${USE_DYNAMIC_WEBAPI_URL}" == "true") {
var getUrl = window.location;
webapi_url = getUrl.protocol + "//" + getUrl.hostname + "${DYNAMIC_WEBAPI_SUFFIX}";
}

// WebAPI
configLocal.api = {
name: 'OHDSI',
url: '${WEBAPI_URL}'
name: '${APP_NAME}',
url: webapi_url
};

configLocal.cohortComparisonResultsEnabled = false;
configLocal.userAuthenticationEnabled = false;
configLocal.plpResultsEnabled = false;
configLocal.cohortComparisonResultsEnabled = ("${COHORT_COMPARISON_RESULTS}" == "true");
configLocal.plpResultsEnabled = ("${PLP_RESULTS}" === "true");
configLocal.userAuthenticationEnabled = ("${USER_AUTHENTICATION}" === "true");
configLocal.authProviders = [];
configLocal.disableBrowserCheck = ("${DISABLE_BROWSER_CHECK}" === "true");
configLocal.enablePermissionManagement = ("${ENABLE_PERMISSIONS_MGMT}" === "true");
configLocal.cacheSources = ("${CACHE_SOURCES}" === "true");
configLocal.enableSkipLogin = ("${SKIP_LOGIN}" === "true"); // automatically opens login window when user is not authenticated
configLocal.useExecutionEngine = ("${USE_EXECUTION_ENGINE}" === "true");
configLocal.viewProfileDates = ("${VIEW_PROFILE_DATES}" === "true");
configLocal.enableCosts = ("${ENABLE_COSTS}" === "true");
configLocal.supportUrl = "${SUPPORT_URL}";
configLocal.supportMail = "${SUPPORT_MAIL}";
configLocal.feedbackContacts = "${FEEDBACK_CONTACTS}";
configLocal.feedbackCustomHtmlTemplate = "${FEEDBACK_HTML}";
configLocal.companyInfoCustomHtmlTemplate = "${COMPANYINFO_HTML}";
configLocal.showCompanyInfo = ("${COMPANYINFO_SHOW}" === "true");
configLocal.defaultLocale = "${DEFAULT_LOCALE}";
configLocal.pollInterval = parseInt("${POLL_INTERVAL}");


if ("${WIN_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${WIN_PROVIDER_NAME}",
url: "${WIN_PROVIDER_URL}",
ajax: ("${WIN_PROVIDER_AJAX}" === "true"),
icon: "${WIN_PROVIDER_ICON}",
});
}

if ("${KERB_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${KERB_PROVIDER_NAME}",
url: "${KERB_PROVIDER_URL}",
ajax: ("${KERB_PROVIDER_AJAX}" === "true"),
icon: "${KERB_PROVIDER_ICON}",
});
}

if ("${OID_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${OID_PROVIDER_NAME}",
url: "${OID_PROVIDER_URL}",
ajax: ("${OID_PROVIDER_AJAX}" === "true"),
icon: "${OID_PROVIDER_ICON}",
});
}

if ("${GGL_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${GGL_PROVIDER_NAME}",
url: "${GGL_PROVIDER_URL}",
ajax: ("${GGL_PROVIDER_AJAX}" === "true"),
icon: "${GGL_PROVIDER_ICON}",
});
}

if ("${FB_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${FB_PROVIDER_NAME}",
url: "${FB_PROVIDER_URL}",
ajax: ("${FB_PROVIDER_AJAX}" === "true"),
icon: "${FB_PROVIDER_ICON}",
});
}

if ("${GH_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${GH_PROVIDER_NAME}",
url: "${GH_PROVIDER_URL}",
ajax: ("${GH_PROVIDER_AJAX}" === "true"),
icon: "${GH_PROVIDER_ICON}",
});
}

if ("${DB_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${DB_PROVIDER_NAME}",
url: "${DB_PROVIDER_URL}",
ajax: ("${DB_PROVIDER_AJAX}" === "true"),
icon: "${DB_PROVIDER_ICON}",
isUseCredentialsForm: ("${DB_PROVIDER_CREDFORM}" === "true")
});
}

if ("${LDAP_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${LDAP_PROVIDER_NAME}",
url: "${LDAP_PROVIDER_URL}",
ajax: ("${LDAP_PROVIDER_AJAX}" === "true"),
icon: "${LDAP_PROVIDER_ICON}",
isUseCredentialsForm: ("${LDAP_PROVIDER_CREDFORM}" === "true")
});
}

if ("${SAML_PROVIDER_ENABLED}" === "true") {
configLocal.authProviders.push(openIdProvider = {
name: "${SAML_PROVIDER_NAME}",
url: "${SAML_PROVIDER_URL}",
ajax: ("${SAML_PROVIDER_AJAX}" === "true"),
icon: "${SAML_PROVIDER_ICON}",
});
}

configLocal.enableTermsAndConditions = ("${ENABLE_TANDCS}" === "true");
configLocal.enablePersonCount = ("${ENABLE_PERSONCOUNT}" === "true");
configLocal.enableTaggingSection = ("${ENABLE_TAGGING_SECTION}" === "true");
configLocal.refreshTokenThreshold = 1000 * 60 * parseInt("${REFRESH_TOKEN_THRESHOLD}");

return configLocal;
});
3 changes: 3 additions & 0 deletions js/config/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Please remember to update the environmental variables in the Dockerfile and the docker config-local.js to reflect
// any new settings introduced here

define(function () {
var appConfig = {};

Expand Down

0 comments on commit d8a1e26

Please sign in to comment.