Skip to content

Commit 6eacd4f

Browse files
author
brakenium
committed
Do not hardcode config file
1 parent c716069 commit 6eacd4f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

spk/influxdb/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ SERVICE_PORT_TITLE = InfluxDB API
3232
ADMIN_PORT = $(SERVICE_PORT)
3333

3434
include ../../mk/spksrc.spk.mk
35+
36+
# Install src/config.yml to var
37+
.PHONY: influxdb_extra_install
38+
influxdb_extra_install:
39+
install -m 755 -d $(STAGING_DIR)/var
40+
install -m 644 src/config.yml $(STAGING_DIR)/var/config.yml

spk/influxdb/src/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
http-bind-address: ":@SERVICE_PORT@"
2+
reporting-disabled: true
3+
bolt-path: "@SYNOPKG_PKGVAR@/.influxdbv2/influxd.bolt"
4+
engine-path: "@SYNOPKG_PKGVAR@/.influxdbv2/engine"
5+
sqlite-path: "@SYNOPKG_PKGVAR@/.influxdbv2/influxd.sqlite"

spk/influxdb/src/service-setup.sh

+6-8
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ SVC_CWD="${SYNOPKG_PKGVAR}"
1010

1111
service_postinst ()
1212
{
13-
cat << EOF > "${INFLUXD_CONFIG_PATH}"
14-
http-bind-address: ":${SERVICE_PORT}"
15-
reporting-disabled: true
16-
bolt-path: "${SYNOPKG_PKGVAR}/.influxdbv2/influxd.bolt"
17-
engine-path: "${SYNOPKG_PKGVAR}/.influxdbv2/engine"
18-
sqlite-path: "${SYNOPKG_PKGVAR}/.influxdbv2/influxd.sqlite"
19-
20-
EOF
13+
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
14+
# Edit the configuration according to the wizard
15+
sed -e "s|@SERVICE_PORT@|${SERVICE_PORT}|g" \
16+
-e "s|@SYNOPKG_PKGVAR@|${SYNOPKG_PKGVAR}|g" \
17+
-i "${INFLUXD_CONFIG_PATH}"
18+
fi
2119
}

0 commit comments

Comments
 (0)