-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added production parameter recognition feature (#468)
- Loading branch information
Murat Ursavas
committed
Jan 30, 2023
1 parent
4b0e204
commit 7361f7c
Showing
4 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# TODO remove below later | ||
echo "SETENV started!" | ||
|
||
base_path="/var/nebra/envvars" | ||
|
||
# Create necessary folder if it doesn't exist | ||
if [ ! -d $base_path ]; then | ||
mkdir -p $base_path | ||
fi | ||
|
||
create_file_if_not_exists() { | ||
local name="$1" | ||
local contents="$2" | ||
local fullpath="${base_path}/${name}" | ||
|
||
if [ ! -f "${fullpath}" ]; then | ||
echo "${name} parameter file doesn't exist. Setting it as ${contents} now."; | ||
echo "${contents}" > "${fullpath}" | ||
fi | ||
} | ||
|
||
export_param_if_not_exists() { | ||
local name="$1" | ||
local fullpath="${base_path}/${name}" | ||
|
||
if [ -f "${fullpath}" ]; then | ||
contents=$(<"${fullpath}"); | ||
export "${name}"="${contents}" | ||
echo "${name} is set as ${contents}."; | ||
else | ||
echo "Error: Cannot set ${name} variable."; | ||
fi | ||
} | ||
|
||
#FREQ | ||
if [ -z ${FREQ+x} ]; then | ||
export_param_if_not_exists FREQ | ||
else | ||
echo "FREQ variable is already set as ${FREQ}."; | ||
create_file_if_not_exists FREQ "${FREQ}" | ||
fi | ||
|
||
#VARIANT | ||
if [ -z ${VARIANT+x} ]; then | ||
export_param_if_not_exists VARIANT | ||
else | ||
echo "VARIANT variable is already set as ${VARIANT}."; | ||
create_file_if_not_exists VARIANT "${VARIANT}" | ||
fi | ||
|
||
# TODO remove below later | ||
echo "SETENV finished!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#! /bin/bash | ||
|
||
# shellcheck source=/dev/null | ||
source /opt/nebra/setenv.sh | ||
|
||
gunicorn --bind 0.0.0.0:5000 --timeout 300 hw_diag.wsgi:wsgi_app |