-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·48 lines (41 loc) · 1.52 KB
/
entrypoint.sh
File metadata and controls
executable file
·48 lines (41 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# Sync default data files from the repo to DATA_DIR.
# products.json: always synced from repo (declarative, not edited at runtime)
# settings/tokens/roles/etc: seeded on first deploy only, then preserved (runtime-editable)
DATA_DIR="${DATA_DIR:-./data}"
REPO_DATA="./data"
# Config files that are ALWAYS overwritten from repo (static/declarative)
ALWAYS_SYNC="products.json"
# Config files that are only seeded on first deploy (runtime-editable)
SEED_ONLY="settings.json tokens.json roles.json shifts-settings.json monitors.json"
if [ -d "$REPO_DATA" ]; then
echo "[entrypoint] Syncing config from $REPO_DATA to $DATA_DIR..."
for guild_dir in "$REPO_DATA"/*/; do
guild_id=$(basename "$guild_dir")
target_dir="$DATA_DIR/$guild_id"
mkdir -p "$target_dir"
# Always overwrite these from repo
for config_file in $ALWAYS_SYNC; do
src="$guild_dir$config_file"
dst="$target_dir/$config_file"
if [ -f "$src" ]; then
cp "$src" "$dst"
echo " ✅ $guild_id/$config_file (synced)"
fi
done
# Only copy if not already present in DATA_DIR
for config_file in $SEED_ONLY; do
src="$guild_dir$config_file"
dst="$target_dir/$config_file"
if [ -f "$src" ] && [ ! -f "$dst" ]; then
cp "$src" "$dst"
echo " 🆕 $guild_id/$config_file (seeded)"
elif [ -f "$dst" ]; then
echo " ⏭️ $guild_id/$config_file (kept existing)"
fi
done
done
echo "[entrypoint] Config sync complete."
fi
# Run the app
exec deno task start