File tree Expand file tree Collapse file tree 3 files changed +48
-9
lines changed Expand file tree Collapse file tree 3 files changed +48
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
- # set the postgres database host, port, user and password
5
+ # set the postgres database host, port, user and password according to the environment
6
+ # and pass them as arguments to the odoo process if not present in the config file
6
7
: ${HOST:= ${DB_PORT_5432_TCP_ADDR:= ' db' } }
7
8
: ${PORT:= ${DB_PORT_5432_TCP_PORT:= 5432} }
8
9
: ${USER:= ${DB_ENV_POSTGRES_USER:= ${POSTGRES_USER:= ' odoo' } } }
9
10
: ${PASSWORD:= ${DB_ENV_POSTGRES_PASSWORD:= ${POSTGRES_PASSWORD:= ' odoo' } } }
10
- # pass them as arguments to the odoo process
11
- DB_ARGS=(" --db_user" $USER " --db_password" $PASSWORD " --db_host" $HOST " --db_port" $PORT )
11
+
12
+ DB_ARGS=()
13
+ function check_config() {
14
+ param=" $1 "
15
+ value=" $2 "
16
+ if ! grep -q -E " ^\s*\b${param} \b\s*=" " $ODOO_RC " ; then
17
+ DB_ARGS+=(" --${param} " )
18
+ DB_ARGS+=(" ${value} " )
19
+ fi ;
20
+ }
21
+ check_config " db_host" " $HOST "
22
+ check_config " db_port" " $PORT "
23
+ check_config " db_user" " $USER "
24
+ check_config " db_password" " $PASSWORD "
12
25
13
26
case " $1 " in
14
27
-- | odoo)
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
- # set the postgres database host, port, user and password
5
+ # set the postgres database host, port, user and password according to the environment
6
+ # and pass them as arguments to the odoo process if not present in the config file
6
7
: ${HOST:= ${DB_PORT_5432_TCP_ADDR:= ' db' } }
7
8
: ${PORT:= ${DB_PORT_5432_TCP_PORT:= 5432} }
8
9
: ${USER:= ${DB_ENV_POSTGRES_USER:= ${POSTGRES_USER:= ' odoo' } } }
9
10
: ${PASSWORD:= ${DB_ENV_POSTGRES_PASSWORD:= ${POSTGRES_PASSWORD:= ' odoo' } } }
10
- # pass them as arguments to the odoo process
11
- DB_ARGS=(" --db_user" $USER " --db_password" $PASSWORD " --db_host" $HOST " --db_port" $PORT )
11
+
12
+ DB_ARGS=()
13
+ function check_config() {
14
+ param=" $1 "
15
+ value=" $2 "
16
+ if ! grep -q -E " ^\s*\b${param} \b\s*=" " $OPENERP_SERVER " ; then
17
+ DB_ARGS+=(" --${param} " )
18
+ DB_ARGS+=(" ${value} " )
19
+ fi ;
20
+ }
21
+ check_config " db_host" " $HOST "
22
+ check_config " db_port" " $PORT "
23
+ check_config " db_user" " $USER "
24
+ check_config " db_password" " $PASSWORD "
12
25
13
26
case " $1 " in
14
27
-- | openerp-server)
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
- # set the postgres database host, port, user and password
5
+ # set the postgres database host, port, user and password according to the environment
6
+ # and pass them as arguments to the odoo process if not present in the config file
6
7
: ${HOST:= ${DB_PORT_5432_TCP_ADDR:= ' db' } }
7
8
: ${PORT:= ${DB_PORT_5432_TCP_PORT:= 5432} }
8
9
: ${USER:= ${DB_ENV_POSTGRES_USER:= ${POSTGRES_USER:= ' odoo' } } }
9
10
: ${PASSWORD:= ${DB_ENV_POSTGRES_PASSWORD:= ${POSTGRES_PASSWORD:= ' odoo' } } }
10
- # pass them as arguments to the odoo process
11
- DB_ARGS=(" --db_user" $USER " --db_password" $PASSWORD " --db_host" $HOST " --db_port" $PORT )
11
+
12
+ DB_ARGS=()
13
+ function check_config() {
14
+ param=" $1 "
15
+ value=" $2 "
16
+ if ! grep -q -E " ^\s*\b${param} \b\s*=" " $OPENERP_SERVER " ; then
17
+ DB_ARGS+=(" --${param} " )
18
+ DB_ARGS+=(" ${value} " )
19
+ fi ;
20
+ }
21
+ check_config " db_host" " $HOST "
22
+ check_config " db_port" " $PORT "
23
+ check_config " db_user" " $USER "
24
+ check_config " db_password" " $PASSWORD "
12
25
13
26
case " $1 " in
14
27
-- | openerp-server)
You can’t perform that action at this time.
0 commit comments