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

Create two env files #1775

Merged
merged 5 commits into from
Sep 6, 2024
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
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ yarn-error.log*

# local environment set up
application-local.yml
local.env
local.env
.env

# cdc-sandbox
dist/

nifi/repo
nifi/nifi_conf/conf/flow.json.gz
archive/
NEDSSDev/
cdc-sandbox/.env
7 changes: 0 additions & 7 deletions cdc-sandbox/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions cdc-sandbox/build_all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh
set -e
BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

source $BASE/check_env.sh

if [ -z "$DATABASE_PASSWORD" ] || [ -z "$NIFI_PASSWORD" ] || [ -z "$KEYCLOAK_ADMIN_PASSWORD" ] || [ -z "$TOKEN_SECRET" ] || [ -z "$PARAMETER_SECRET" ]
then
Expand Down
8 changes: 7 additions & 1 deletion cdc-sandbox/build_classic.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#!/bin/sh
set -e

BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

source $BASE/check_env.sh

if [ -z "$DATABASE_PASSWORD" ]
then
echo "DATABASE_PASSWORD is required"
exit 1
else
echo "Building NBS classic with:"
echo "DATABASE_PASSWORD=$DATABASE_PASSWORD"
fi

BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

CLASSIC_PATH=$BASE/nbs-classic/builder/NEDSSDev
CLASSIC_VERSION=NBS_6.0.16
Expand Down
11 changes: 10 additions & 1 deletion cdc-sandbox/build_modernized.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
#!/bin/sh
set -e
BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

source $BASE/check_env.sh

if [ -z "$DATABASE_PASSWORD" ] || [ -z "$NIFI_PASSWORD" ] || [ -z "$KEYCLOAK_ADMIN_PASSWORD" ] || [ -z "$TOKEN_SECRET" ] || [ -z "$PARAMETER_SECRET" ]
then
echo "DATABASE_PASSWORD, NIFI_PASSWORD, KEYCLOAK_ADMIN_PASSWORD, TOKEN_SECRET are required"
exit 1
else
echo "Building modernized services with:"
echo "DATABASE_PASSWORD: $DATABASE_PASSWORD"
echo "NIFI_PASSWORD: $NIFI_PASSWORD"
echo "KEYCLOAK_ADMIN_PASSWORD: $KEYCLOAK_ADMIN_PASSWORD"
echo "PARAMETER_SECRET: $PARAMETER_SECRET"
echo "TOKEN_SECRET: $TOKEN_SECRET"
fi

BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

# Start ES and the proxy
echo "Starting elasticsearch reverse-proxy"
Expand Down
32 changes: 32 additions & 0 deletions cdc-sandbox/check_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set -e
BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$BASE/.."

# Checks for the presence of a `.env` file in the scripts directory.
# If one is found, load the values, otherwise create the .env with placeholders for expected values
if [ -f $BASE/.env ] && [ -f $ROOT/.env ]; then
echo "Reading from .env files..."
source "$BASE/.env"
source "$ROOT/.env"
else
echo "No .env file found, creating..."
echo "DATABASE_PASSWORD=$DATABASE_PASSWORD" > $BASE/.env
echo "NIFI_PASSWORD=$NIFI_PASSWORD" >> $BASE/.env
echo "KEYCLOAK_ADMIN_PASSWORD=$KEYCLOAK_ADMIN_PASSWORD" >> $BASE/.env

echo "DATABASE_PASSWORD=$DATABASE_PASSWORD" > $ROOT/.env
echo "TOKEN_SECRET=$TOKEN_SECRET" >> $ROOT/.env
echo "PARAMETER_SECRET=$PARAMETER_SECRET" >> $ROOT/.env

# Supplmental values
echo 'NBS_DATASOURCE_SERVER=nbs-mssql' >> $ROOT/.env
echo 'CLASSIC_SERVICE=wildfly:7001' >> $ROOT/.env
echo 'MODERNIZATION_SERVICE=${MODERNIZATION_API_SERVER:-modernization-api}:${MODERNIZATION_API_PORT:-8080}' >> $ROOT/.env
echo 'UI_SERVICE=${MODERNIZATION_UI_SERVER:-modernization-api}:${MODERNIZATION_UI_PORT:-8080}' >> $ROOT/.env
echo 'PAGEBUILDER_SERVICE=${PAGEBUILDER_API_SERVER:-pagebuilder-api}:${PAGEBUILDER_API_PORT:-8095}' >> $ROOT/.env
echo 'NBS_SECURITY_OIDC_ENABLED=${OIDC_ENABLED:-false}' >> $ROOT/.env
echo 'NBS_SECURITY_OIDC_URI=${ISSUER_URI:-http://keycloak:8080/realms/nbs-users}' >> $ROOT/.env
echo 'PAGEBUILDER_ENABLED=true' >> $ROOT/.env


fi