Skip to content

Commit b7f7d8b

Browse files
author
Alex J Lennon
committed
Add production API config to eink-scheduler and disable service by default
- Disable eink-scheduler service by default to prevent board from sleeping too quickly during development/testing - Add production API configuration section to eink-scheduler.conf.example - Development API (api.dev.e-tabelone.com) is active by default - Production API (api.e-tabelone.com) is commented out for easy switching - Configuration file includes both dev and production settings directly in the file
1 parent 439cd9f commit b7f7d8b

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

bbappends/meta-rust-bin/recipes-rust/eink-scheduler/eink-scheduler_git.bbappend

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,23 @@
33
# Service can be manually enabled with: systemctl enable eink-scheduler
44
SYSTEMD_AUTO_ENABLE:${PN} = "disable"
55

6-
# Modify configuration file to add production API configuration section
6+
# Replace configuration file with version that includes both dev and production API settings
7+
SRC_URI += "file://eink-scheduler.conf.example"
8+
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
9+
710
do_install:append() {
8-
# Find and modify the configuration example file to add production API settings
9-
for conf_file in \
10-
"${D}${datadir}/doc/eink-scheduler/eink-scheduler.conf.example" \
11-
"${D}${sysconfdir}/eink-scheduler-rust/eink-scheduler.conf.example" \
12-
"${D}${docdir}/eink-scheduler/eink-scheduler.conf.example"; do
13-
if [ -f "$conf_file" ]; then
14-
# Insert production API configuration section after development AUTH_TOKEN line
15-
awk '/^AUTH_TOKEN=your-bearer-token-here$/ {
16-
print;
17-
print "";
18-
print "# Production API Configuration (commented out - uncomment for production use)";
19-
print "# API_BASE_URL=https://api.e-tabelone.com";
20-
print "# API_PATH_TEMPLATE=/node/v0/device/{DEVICE_ID}/config";
21-
print "# TELEMETRY_PATH_TEMPLATE=/node/v0/device/{DEVICE_ID}/telemetry";
22-
print "# AUTH_TOKEN=your-bearer-token-here";
23-
next
24-
}
25-
{ print }' "$conf_file" > "$conf_file.tmp" && mv "$conf_file.tmp" "$conf_file"
26-
break
27-
fi
28-
done
11+
# Replace the configuration example file with our version that has both dev and production settings
12+
if [ -f ${WORKDIR}/eink-scheduler.conf.example ]; then
13+
# Find where the original config was installed and replace it
14+
for conf_dir in \
15+
"${D}${datadir}/doc/eink-scheduler" \
16+
"${D}${sysconfdir}/eink-scheduler-rust" \
17+
"${D}${docdir}/eink-scheduler"; do
18+
if [ -f "$conf_dir/eink-scheduler.conf.example" ]; then
19+
install -m 0644 ${WORKDIR}/eink-scheduler.conf.example "$conf_dir/eink-scheduler.conf.example"
20+
break
21+
fi
22+
done
23+
fi
2924
}
3025

0 commit comments

Comments
 (0)