Qwer commited on
Create entrypoint.sh
Browse files- entrypoint.sh +20 -0
entrypoint.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
|
| 4 |
+
mkdir -p /data
|
| 5 |
+
|
| 6 |
+
init_json_file() {
|
| 7 |
+
file_path="$1"
|
| 8 |
+
default_content="$2"
|
| 9 |
+
|
| 10 |
+
if [ ! -f "$file_path" ]; then
|
| 11 |
+
printf '%s\n' "$default_content" > "$file_path"
|
| 12 |
+
fi
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
init_json_file "${ACCOUNTS_FILE:-/data/accounts.json}" '[]'
|
| 16 |
+
init_json_file "${USERS_FILE:-/data/users.json}" '[]'
|
| 17 |
+
init_json_file "${CAPTURES_FILE:-/data/captures.json}" '[]'
|
| 18 |
+
init_json_file "${CONFIG_FILE:-/data/config.json}" '{}'
|
| 19 |
+
|
| 20 |
+
exec "$@"
|