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

Configurable DB_NAME #535

Open
singatias opened this issue Dec 30, 2024 · 0 comments
Open

Configurable DB_NAME #535

singatias opened this issue Dec 30, 2024 · 0 comments

Comments

@singatias
Copy link

singatias commented Dec 30, 2024

Hello,

Why is the database name hardcoded? Even if you change it in the odoo.conf, the Docker container won't be compatible with a PostgreSQL database that doesn't have a database named 'postgres'. Multiple people have reported this issue and created PRs to address it, but none of them have been taken seriously. I'm currently creating a Helm chart for Odoo and have to jump through hoops to get it set up.

#459 #426

Obviously these PRs were neglected for so long but it would be nice if the Odoo team merge a solution once and for all to this issue.

conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')

# set the postgres database host, port, user and password according to the environment
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
fi;
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}
check_config "db_host" "$HOST"
check_config "db_port" "$PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"

Best Regards,
Mathias Beaulieu-Duncan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant