mirror of
https://github.com/odoocker/odoocker
synced 2025-11-04 15:19:22 +01:00
enhanced .env variable usage
This commit is contained in:
@@ -2,6 +2,18 @@
|
||||
|
||||
set -e
|
||||
|
||||
while IFS='=' read -r key value || [[ -n $key ]]; do
|
||||
# Skip comments and empty lines
|
||||
[[ $key =~ ^#.* ]] || [[ -z $key ]] && continue
|
||||
|
||||
# Removing any quotes around the value
|
||||
value=${value%\"}
|
||||
value=${value#\"}
|
||||
|
||||
# Declare variable
|
||||
eval "$key=\"$value\""
|
||||
done < .env
|
||||
|
||||
case "$1" in
|
||||
-- | odoo)
|
||||
shift
|
||||
@@ -9,7 +21,7 @@ case "$1" in
|
||||
# Creates new module.
|
||||
exec odoo "$@"
|
||||
else
|
||||
wait-for-psql.py --db_host ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30
|
||||
wait-for-psql.py --db_host ${HOST} --db_port ${PORT} --db_user ${USER} --db_password ${PASSWORD} --timeout=30
|
||||
|
||||
if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then
|
||||
# Ideal for a fresh install or restore a production database.
|
||||
@@ -18,13 +30,6 @@ case "$1" in
|
||||
exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
|
||||
fi
|
||||
|
||||
if [ ${APP_ENV} = 'full' ] ; then
|
||||
# Ideal for initializing a fresh database with a huge amount of addons.
|
||||
echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update= --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200
|
||||
|
||||
exec odoo --config ${ODOO_RC} --update= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
|
||||
fi
|
||||
|
||||
if [ ${APP_ENV} = 'local' ] ; then
|
||||
# Listens to all .env variables mapped into odoo.conf file.
|
||||
echo odoo --config ${ODOO_RC}
|
||||
@@ -41,16 +46,16 @@ case "$1" in
|
||||
|
||||
if [ ${APP_ENV} = 'testing' ] ; then
|
||||
# Initializies a fresh 'test_*' database, installs the addons to test, and runs tests you specify in the test tags.
|
||||
echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init
|
||||
echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --dev= --stop-after-init
|
||||
|
||||
exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --without-demo= --workers=0 --stop-after-init
|
||||
exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --without-demo= --workers=0 --dev= --stop-after-init
|
||||
fi
|
||||
|
||||
if [ ${APP_ENV} = 'staging' ] ; then
|
||||
# Automagically upgrade all addons and install new ones. Ideal for deployment process.
|
||||
echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200
|
||||
echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --dev=
|
||||
|
||||
exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
|
||||
exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 --dev=
|
||||
fi
|
||||
|
||||
if [ ${APP_ENV} = 'production' ] ; then
|
||||
@@ -63,7 +68,7 @@ case "$1" in
|
||||
;;
|
||||
-*)
|
||||
|
||||
wait-for-psql.py --db_host ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30
|
||||
wait-for-psql.py --db_host ${HOST} --db_port ${PORT} --db_user ${USER} --db_password ${PASSWORD} --timeout=30
|
||||
echo odoo --config ${ODOO_RC}
|
||||
exec odoo --config ${ODOO_RC}
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user