Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 16 additions & 5 deletions deploy/docker/fs/opt/appsmith/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ init_env_file() {
ENV_PATH="$CONF_PATH/docker.env"
TEMPLATES_PATH="/opt/appsmith/templates"

if [[ -n "$APPSMITH_MONGODB_URI" ]]; then
export APPSMITH_DB_URL="$APPSMITH_MONGODB_URI"
unset APPSMITH_MONGODB_URI
fi

Comment thread
sharat87 marked this conversation as resolved.
# Build an env file with current env variables. We single-quote the values, as well as escaping any single-quote characters.
printenv | grep -E '^APPSMITH_|^MONGO_' | sed "s/'/'\\\''/g; s/=/='/; s/$/'/" > "$TMP/pre-define.env"

Expand Down Expand Up @@ -75,8 +80,19 @@ init_env_file() {


tlog "Load environment configuration"

# Load the ones in `docker.env` in the stacks folder.
set -o allexport
. "$ENV_PATH"
Comment thread
sharat87 marked this conversation as resolved.
set +o allexport

if [[ -n "$APPSMITH_MONGODB_URI" ]]; then
export APPSMITH_DB_URL="$APPSMITH_MONGODB_URI"
unset APPSMITH_MONGODB_URI
fi

Comment thread
sharat87 marked this conversation as resolved.
# Load the ones set from outside, should take precedence, and so will overwrite anything from `docker.env` above.
set -o allexport
Comment thread
sharat87 marked this conversation as resolved.
Comment thread
sharat87 marked this conversation as resolved.
. "$TMP/pre-define.env"
set +o allexport
}
Expand Down Expand Up @@ -172,11 +188,6 @@ configure_database_connection_url() {
tlog "Configuring database connection URL"
isPostgresUrl=0
isMongoUrl=0
# Check if APPSMITH_DB_URL is not set
if [[ -z "${APPSMITH_DB_URL}" ]]; then
# If APPSMITH_DB_URL is not set, fall back to APPSMITH_MONGODB_URI
export APPSMITH_DB_URL="${APPSMITH_MONGODB_URI}"
fi

if [[ "${APPSMITH_DB_URL}" == "postgresql:"* ]]; then
isPostgresUrl=1
Expand Down
8 changes: 7 additions & 1 deletion deploy/docker/fs/opt/appsmith/utils/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ const mongo_shell_utils = require("./mongo_shell_utils.js");

const APPLICATION_CONFIG_PATH = "/appsmith-stacks/configuration/docker.env";

// Check if APPSMITH_DB_URL is set, if not set, fall back to APPSMITH_MONGODB_URI
if (!process.env.APPSMITH_DB_URL) {
process.env.APPSMITH_DB_URL = process.env.APPSMITH_MONGODB_URI;
delete process.env.APPSMITH_MONGODB_URI;
Comment thread
sharat87 marked this conversation as resolved.
}
Comment thread
sharat87 marked this conversation as resolved.

Comment thread
sharat87 marked this conversation as resolved.
// Loading latest application configuration
require("dotenv").config({ path: APPLICATION_CONFIG_PATH });

// Check if APPSMITH_DB_URL is set, if not set, fall back to APPSMITH_MONGODB_URI
// AGAIN: Check if APPSMITH_DB_URL is set, if not set, fall back to APPSMITH_MONGODB_URI
Comment thread
sharat87 marked this conversation as resolved.
if (!process.env.APPSMITH_DB_URL) {
Comment thread
abhvsn marked this conversation as resolved.
process.env.APPSMITH_DB_URL = process.env.APPSMITH_MONGODB_URI;
}
Expand Down