From 79b731f71d6ea1d0a5be2aff2e80e9608b67e82c Mon Sep 17 00:00:00 2001 From: Samus CTO Date: Fri, 27 Feb 2015 15:17:44 +0100 Subject: [PATCH] [IMP] use PG var envs to find the database Set /var/lib/odoo as data_dir to keep filestore and addons located there instead of /var/lib/odoo/.local/share/Odoo --- 8.0/openerp-server.conf | 6 +----- 8.0/run.sh | 26 ++++++-------------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/8.0/openerp-server.conf b/8.0/openerp-server.conf index 0ca62de..679610c 100644 --- a/8.0/openerp-server.conf +++ b/8.0/openerp-server.conf @@ -1,13 +1,9 @@ [options] addons_path = /usr/lib/python2.7/dist-packages/openerp/addons,/mnt/extra-addons +data_dir = /var/lib/odoo auto_reload = True -db_host = False -db_password = False -db_port = False -db_user = odoo ; admin_passwd = admin ; csv_internal_sep = , -; data_dir = False ; db_maxconn = 64 ; db_name = False ; db_template = template1 diff --git a/8.0/run.sh b/8.0/run.sh index f1dd6a0..efa7b62 100755 --- a/8.0/run.sh +++ b/8.0/run.sh @@ -1,24 +1,10 @@ #!/bin/bash -CONFIG_FILE=/etc/odoo/openerp-server.conf - -# sets a configuration variable in openerp-server.conf -# $1: key, $2: value -function set_config { - if grep -q "^$1.*" $CONFIG_FILE - then - sed -i "s/^$1.*$/$1 = $2/" $CONFIG_FILE - else - sed -i "$ a$1 = $2" $CONFIG_FILE - fi -} - -# set odoo data directory and database host, port, user and password -set_config "data_dir" "\/var\/lib\/odoo" -set_config "db_host" $DB_PORT_5432_TCP_ADDR -set_config "db_port" $DB_PORT_5432_TCP_PORT -set_config "db_user" $DB_ENV_POSTGRES_USER -set_config "db_password" $DB_ENV_POSTGRES_PASSWORD +# set odoo database host, port, user and password +export PGHOST=$DB_PORT_5432_TCP_ADDR +export PGPORT=$DB_PORT_5432_TCP_PORT +export PGUSER=$DB_ENV_POSTGRES_USER +export PGPASSWORD=$DB_ENV_POSTGRES_PASSWORD # start Odoo -exec gosu odoo /usr/bin/openerp-server --config $CONFIG_FILE +exec gosu odoo /usr/bin/openerp-server --config=/etc/odoo/openerp-server.conf