update : refactor generating config
This commit is contained in:
parent
acd663ba1b
commit
50c29d8d6f
6
Makefile
6
Makefile
@ -1,3 +1,6 @@
|
|||||||
|
ifneq ("$(wildcard .env)", "")
|
||||||
|
include .env
|
||||||
|
endif
|
||||||
.SHELLFLAGS += ${SHELLFLAGS} -e
|
.SHELLFLAGS += ${SHELLFLAGS} -e
|
||||||
PWD = $(shell pwd)
|
PWD = $(shell pwd)
|
||||||
UID = $(shell id -u)
|
UID = $(shell id -u)
|
||||||
@ -23,6 +26,7 @@ CONTAINER_ID=${PROJECT}-${TAG}
|
|||||||
VERSION := community
|
VERSION := community
|
||||||
ADDONS=${PWD}/addons,${PWD}/odoo/addons,${PWD}/extra-addons
|
ADDONS=${PWD}/addons,${PWD}/odoo/addons,${PWD}/extra-addons
|
||||||
BACKUP=${CDN}/raw/branch/main/backup/${VERSION}/odoo18-main_2025-01-15_08-05-47.zip
|
BACKUP=${CDN}/raw/branch/main/backup/${VERSION}/odoo18-main_2025-01-15_08-05-47.zip
|
||||||
|
|
||||||
##### Native Deployment#########
|
##### Native Deployment#########
|
||||||
install:
|
install:
|
||||||
sudo apt update -y && \
|
sudo apt update -y && \
|
||||||
@ -41,7 +45,7 @@ download_backup:
|
|||||||
${PWD}/setup/download_backup.sh $$LinkDB backup.zip
|
${PWD}/setup/download_backup.sh $$LinkDB backup.zip
|
||||||
gen_config:
|
gen_config:
|
||||||
$(MAKE) download_backup LINKDB=${BACKUP}
|
$(MAKE) download_backup LINKDB=${BACKUP}
|
||||||
${PWD}/setup/init_config.sh --native ${ADDONS}
|
${PWD}/setup/init_config.sh --native ${ADDONS} ${DB_USER} ${DB_PASSWORD} ${DB_SERVER} ${DB_PORT}
|
||||||
run_server:
|
run_server:
|
||||||
${PYTHON} odoo-bin --config=${CONFIG}
|
${PYTHON} odoo-bin --config=${CONFIG}
|
||||||
run_test:
|
run_test:
|
||||||
|
4
env.template
Normal file
4
env.template
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
DB_USER=
|
||||||
|
DB_PASSWORD=
|
||||||
|
DB_SERVER=
|
||||||
|
DB_PORT=5432
|
@ -1 +1 @@
|
|||||||
Subproject commit 2594c72537fcfc6d8d41ac359d48c6d37f61947d
|
Subproject commit d8d6966b2c86037b89304306d9880b65f8c65afa
|
@ -6,6 +6,8 @@ set -euo pipefail
|
|||||||
DEPLOY_PATH=$(pwd)/deployment
|
DEPLOY_PATH=$(pwd)/deployment
|
||||||
SETUP_PATH=$(pwd)/setup
|
SETUP_PATH=$(pwd)/setup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PIP=$(pwd)/venv/bin/pip
|
PIP=$(pwd)/venv/bin/pip
|
||||||
PYTHON=$(pwd)/venv/bin/python
|
PYTHON=$(pwd)/venv/bin/python
|
||||||
ODOO_ADDONS=${DEPLOY_PATH}/addons
|
ODOO_ADDONS=${DEPLOY_PATH}/addons
|
||||||
@ -194,9 +196,10 @@ Generate_Config_Docker(){
|
|||||||
Show 0 " Generate Config Complete"
|
Show 0 " Generate Config Complete"
|
||||||
}
|
}
|
||||||
Generate_Config_Native(){
|
Generate_Config_Native(){
|
||||||
# Load environment variables from .env file
|
DB_USER=${2:-}
|
||||||
Show 2 "Environment variables loaded:"
|
DB_PASSWORD=${3:-}
|
||||||
printenv | sort
|
DB_SERVER=${4:-}
|
||||||
|
DB_PORT=${5:-}
|
||||||
ADDONS=${1:-}
|
ADDONS=${1:-}
|
||||||
REPO_NAME=$(basename "$(git rev-parse --show-toplevel)" | sed -E 's/[.-]/_/g')
|
REPO_NAME=$(basename "$(git rev-parse --show-toplevel)" | sed -E 's/[.-]/_/g')
|
||||||
USER="${REPO_NAME:-"default_repo"}"
|
USER="${REPO_NAME:-"default_repo"}"
|
||||||
@ -230,7 +233,7 @@ main(){
|
|||||||
# Check_Docker_Install
|
# Check_Docker_Install
|
||||||
case "$TYPE" in
|
case "$TYPE" in
|
||||||
--native)
|
--native)
|
||||||
Generate_Config_Native $2
|
Generate_Config_Native $2 $3 $4 $5 $6
|
||||||
;;
|
;;
|
||||||
--docker)
|
--docker)
|
||||||
Generate_Config_Docker $2 $3 $4
|
Generate_Config_Docker $2 $3 $4
|
||||||
@ -242,4 +245,4 @@ main(){
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
main ${1:-} ${2:-} ${3:-} ${4:-}
|
main "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user