Skip to content

Commit

Permalink
Do not hardcode config file
Browse files Browse the repository at this point in the history
  • Loading branch information
brakenium committed Dec 27, 2023
1 parent c716069 commit 2587c4f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
8 changes: 8 additions & 0 deletions spk/influxdb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ SERVICE_PORT_TITLE = InfluxDB API
# Admin link for in DSM UI
ADMIN_PORT = $(SERVICE_PORT)

POST_STRIP_TARGET = influxdb_extra_install

include ../../mk/spksrc.spk.mk

# Install src/config.yml to var
.PHONY: influxdb_extra_install
influxdb_extra_install:
install -m 755 -d $(STAGING_DIR)/var
install -m 644 src/config.yml $(STAGING_DIR)/var/config.yml
5 changes: 5 additions & 0 deletions spk/influxdb/src/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
http-bind-address: ":@SERVICE_PORT@"
reporting-disabled: true
bolt-path: "@SYNOPKG_PKGVAR@/.influxdbv2/influxd.bolt"
engine-path: "@SYNOPKG_PKGVAR@/.influxdbv2/engine"
sqlite-path: "@SYNOPKG_PKGVAR@/.influxdbv2/influxd.sqlite"
14 changes: 6 additions & 8 deletions spk/influxdb/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ SVC_CWD="${SYNOPKG_PKGVAR}"

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

0 comments on commit 2587c4f

Please sign in to comment.