Skip to content

Commit 2b60396

Browse files
committed
try to set the currencies used
1 parent 9fd1e79 commit 2b60396

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

debian/cnb-cache.config

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ set -e
77
db_version 2.0
88

99
db_title Reconfigure webserever
10-
db_input high cnb-cache/reconfigure-webserver || true
10+
db_input low cnb-cache/reconfigure-webserver || true
1111

1212
db_go || true
13-
db_stop
13+
14+
db_title Choose currencies to cache
15+
db_input low cnb-cache/currencies || true
16+
db_go || true

debian/cnb-cache.postinst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
set -e
33
#set -x
44

5+
composer-debian cnb-cache
6+
57

68
. /usr/share/debconf/confmodule
79

@@ -143,7 +145,19 @@ case "$1" in
143145
done
144146
fi
145147

146-
composer-debian cnb-cache
148+
db_title "Choose currencies to cache"
149+
db_get cnb-cache/currencies || true
150+
currencies="$RET"
151+
152+
# Update or populate CURRENCIES key in /etc/cnb-cache/cnb-cache.env with $currencies
153+
if [ -n "$currencies" ]; then
154+
if grep -q "^CURRENCIES=" /etc/cnb-cache/cnb-cache.env; then
155+
sed -i "s/^CURRENCIES=.*/CURRENCIES=\"$currencies\"/" /etc/cnb-cache/cnb-cache.env
156+
else
157+
echo "CURRENCIES=\"$currencies\"" >> /etc/cnb-cache/cnb-cache.env
158+
fi
159+
fi
160+
147161
cnb-cache-init
148162

149163
;;

debian/conf/.env.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
APP_DEBUG=false
21
DB_CONNECTION=_DBC_DBTYPE_
32
DB_HOST=_DBC_DBSERVER_
43
DB_PORT=_DBC_DBPORT_
54
DB_DATABASE=/var/lib/dbconfig-common/sqlite3/cnb-cache/_DBC_DBNAME_
65
DB_USERNAME=_DBC_DBUSER_
76
DB_PASSWORD=_DBC_DBPASS_
7+
CURRENCIES=USD,EUR
8+
EASE_LOGGER=syslog

debian/templates

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
Template: cnb-cache/reconfigure-webserver
22
Type: multiselect
33
Choices: apache2, lighttpd
4-
_Description: Web server to reconfigure automatically:
4+
Description: Web server to reconfigure automatically:
55
Please choose the web server that should be automatically configured
66
to run CNB Cache.
77

88
Template: cnb-cache/restart-webserver
99
Type: boolean
1010
Default: true
11-
_Description: Restart configured webserver automatically:
11+
Description: Restart configured webserver automatically:
1212
Or restart webserver by yourself.
1313

14-
Template: cnb-cache/database-type
15-
Type: string
16-
Default: sqlite
17-
_Description: Database type:
18-
Please choose the database type to use with CNB Cache.
14+
Template: cnb-cache/currencies
15+
Type: multiselect
16+
Default: USD, EUR
17+
Choices: AUD, BRL, BGN, CNY, DKK, EUR, PHP, HKD, INR, IDR, ISK, ILS, JPY, ZAR, CAD, KRW, HUF, MYR, MXN, XDR, NOK, NZD, PLN, RON, SGD, SEK, CHF, THB, TRY, USD, GBP
18+
Description: Currencies to cache:
19+
Please choose the currencies that should be cached.

0 commit comments

Comments
 (0)