Move system specific values into _templates
Added szetup.sh to link to the system specific templates
This commit is contained in:
parent
cae38fd808
commit
34a8199902
|
@ -1,9 +1,15 @@
|
|||
.env.local
|
||||
# These will be a local sym-link
|
||||
*.local
|
||||
*.local.yml
|
||||
# local env should not be committed
|
||||
app.env
|
||||
# local data should always be in a subdir named local, and never committed
|
||||
**/local
|
||||
# traefik/tls and /sahred shouldn't exist, but in case they are copied over - don't commit them
|
||||
_traefik/tls
|
||||
_traefik/shared
|
||||
**/app.env
|
||||
ddns-updater/config.json
|
||||
# This is will be a local sym-link
|
||||
*.local.yml
|
||||
*.local
|
||||
local.*
|
||||
# make it eash to disable stuff without committing
|
||||
tmp.*
|
||||
*.tmp
|
||||
*.off
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
http:
|
||||
routers:
|
||||
# Define a connection between requests and services
|
||||
"to-ha":
|
||||
home-assistant:
|
||||
rule: "Host(`ha.shefet.net`)"
|
||||
entrypoints:
|
||||
- websecure
|
|
@ -2,7 +2,7 @@
|
|||
http:
|
||||
routers:
|
||||
# Define a connection between requests and services
|
||||
"to-ha":
|
||||
home-assistant:
|
||||
rule: "Host(`ha.lksz.me`)"
|
||||
entrypoints:
|
||||
- websecure
|
|
@ -0,0 +1,35 @@
|
|||
#! /usr/bin/env bash
|
||||
set -e
|
||||
SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"}
|
||||
|
||||
SYS_NAME=${1:-${SYS_NAME:?Must supply sysname as 1st argument}}
|
||||
TOP_DIR="$SCRIPT_DIR/_traefik/dynamic"
|
||||
|
||||
# Store the find results in an array
|
||||
mapfile -d '' -t DELETE < <(find "$TOP_DIR" -maxdepth 1 -mindepth 1 -type l -lname '*_templates/*' -print0)
|
||||
|
||||
# If links were found, process and delete them
|
||||
if [ ${#DELETE[@]} -gt 0 ]; then
|
||||
for link in "${DELETE[@]}"; do
|
||||
# Get the target of the symbolic link
|
||||
target=$(basename $(readlink -f "$link"))
|
||||
|
||||
# Delete the link
|
||||
rm "$link"
|
||||
|
||||
# Report the deleted link and its target
|
||||
printf '"%s" (%s) deleted.\n' "$link" "${target##*.}"
|
||||
done
|
||||
else
|
||||
echo "No matching symbolic links found to delete."
|
||||
fi
|
||||
|
||||
|
||||
find "$TOP_DIR/_templates" -maxdepth 1 -mindepth 1 -type f -name "*.${SYS_NAME}" -print0 \
|
||||
| while IFS= read -r -d '' file; do
|
||||
base=$(basename "$file" ".${SYS_NAME}")
|
||||
ext="${base##*.}"
|
||||
#echo ln -rs "${file#${TOP_DIR}/}" "${base}"
|
||||
ln -vrs "${file}" "${TOP_DIR}/${base%${ext}}local.$ext"t
|
||||
done
|
||||
|
Loading…
Reference in New Issue