feat: 切换邮箱认证并重构前后端启动与门禁
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
load_env_file() {
|
||||
local env_file="$1"
|
||||
if [ ! -f "$env_file" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
while IFS= read -r raw_line || [ -n "$raw_line" ]; do
|
||||
local line key value
|
||||
line="${raw_line%$'\r'}"
|
||||
|
||||
[[ -z "${line//[[:space:]]/}" ]] && continue
|
||||
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
||||
[[ "$line" != *"="* ]] && continue
|
||||
|
||||
key="${line%%=*}"
|
||||
value="${line#*=}"
|
||||
key="${key#${key%%[![:space:]]*}}"
|
||||
key="${key%${key##*[![:space:]]}}"
|
||||
|
||||
if [[ ! "$key" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
value="${value#${value%%[![:space:]]*}}"
|
||||
value="${value%${value##*[![:space:]]}}"
|
||||
|
||||
if [[ "$value" =~ ^\".*\"$ ]]; then
|
||||
value="${value:1:${#value}-2}"
|
||||
elif [[ "$value" =~ ^\'.*\'$ ]]; then
|
||||
value="${value:1:${#value}-2}"
|
||||
fi
|
||||
|
||||
export "$key=$value"
|
||||
done < "$env_file"
|
||||
}
|
||||
Reference in New Issue
Block a user