Skip to content

Commit 013538f

Browse files
author
Timon Tschanz
committed
Add Script to set report.url
1 parent b7b27db commit 013538f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Diff for: HISTORY.rst

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
Release History
1919
---------------
2020

21+
unreleased
22+
++++++++++
23+
24+
**Features and Improvements**
25+
26+
* Add Script to set report.url if provided.
27+
2128
2.5.1 (2018-01-11)
2229
++++++++++++++++++
2330

Diff for: start-entrypoint.d/001_set_report_url

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
DOMAIN="${ODOO_REPORT_URL}"
4+
5+
if [ -n "$DOMAIN" ]; then
6+
7+
if [ "$( psql -tAc "SELECT 1 FROM pg_database WHERE datname='$DB_NAME'" )" != '1' ]
8+
then
9+
echo "Database does not exist, ignoring script"
10+
exit 0
11+
fi
12+
13+
echo "Setting Report URL to domain ${DOMAIN}"
14+
psql --quiet << EOF
15+
16+
WITH update_param AS (
17+
UPDATE ir_config_parameter
18+
SET value = '${DOMAIN}'
19+
WHERE key = 'report.url'
20+
RETURNING *
21+
)
22+
INSERT INTO ir_config_parameter
23+
(value, key, create_uid, write_uid, create_date, write_date)
24+
SELECT '${DOMAIN}', 'report.url', 1, 1, now(), now()
25+
WHERE NOT EXISTS (SELECT * FROM update_param);
26+
27+
EOF
28+
fi

0 commit comments

Comments
 (0)