fix config
This commit is contained in:
parent
2fd88401f5
commit
a2483d3c5d
@ -21,9 +21,11 @@ SERVICE_GROUP="${SERVICE_GROUP:-$(id -gn "$SERVICE_USER")}"
|
|||||||
# "service_group"
|
# "service_group"
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# Environment variables are rendered into the corresponding systemd service
|
# IOT_ENV and EFKA_ENV are rendered into the corresponding systemd service
|
||||||
# file by service_env_lines(), using the [prod] sections from iot/env.file and
|
# file as Environment= lines, using the [prod] sections from iot/env.file and
|
||||||
# efka/env.file. Directory creation is driven by those service env values.
|
# efka/env.file. Directory creation is driven by those service env values.
|
||||||
|
# IOT_DIR_ENV_KEYS and EFKA_DIR_ENV_KEYS list env keys whose values are
|
||||||
|
# directories that must be created if they do not exist.
|
||||||
#
|
#
|
||||||
# Use {install_dir}, {work_dir} and {service_name} in commands and directories.
|
# Use {install_dir}, {work_dir} and {service_name} in commands and directories.
|
||||||
# service_user and service_group are optional.
|
# service_user and service_group are optional.
|
||||||
@ -37,6 +39,19 @@ INSTALL_IOT=(
|
|||||||
""
|
""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IOT_ENV=(
|
||||||
|
"IOT_API_URL=http://127.0.0.1/api/v1"
|
||||||
|
"ENDPOINT_ROOT_DIR=/var/lib/endpoint/database/"
|
||||||
|
"ENDPOINT_LOG_PATH=/var/lib/endpoint/endpoint_log"
|
||||||
|
"IOT_MNESIA_DIR=/var/lib/iot/mnesia/"
|
||||||
|
)
|
||||||
|
|
||||||
|
IOT_DIR_ENV_KEYS=(
|
||||||
|
"ENDPOINT_ROOT_DIR"
|
||||||
|
"ENDPOINT_LOG_PATH"
|
||||||
|
"IOT_MNESIA_DIR"
|
||||||
|
)
|
||||||
|
|
||||||
INSTALL_EFKA=(
|
INSTALL_EFKA=(
|
||||||
"efka"
|
"efka"
|
||||||
"https://punchsky.cn/down/efka-0.1.0.tar.gz"
|
"https://punchsky.cn/down/efka-0.1.0.tar.gz"
|
||||||
@ -45,6 +60,22 @@ INSTALL_EFKA=(
|
|||||||
""
|
""
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
EFKA_ENV=(
|
||||||
|
"EFKA_DETS_DIR=/var/lib/efka/dets/"
|
||||||
|
"EFKA_IOT_HOST=localhost"
|
||||||
|
"EFKA_AUTH_UUID=qbxmjyzrkpntfgswaevodhluicqzxplkm"
|
||||||
|
"EFKA_AUTH_TOKEN=zpxlkvmqwnbghytrujsdieofazxcvbnm"
|
||||||
|
"EFKA_DOCKER_ROOT_DIR=/var/lib/efka/docker/"
|
||||||
|
"EFKA_MNESIA_DIR=/var/lib/efka/mnesia"
|
||||||
|
)
|
||||||
|
|
||||||
|
EFKA_DIR_ENV_KEYS=(
|
||||||
|
"EFKA_DETS_DIR"
|
||||||
|
"EFKA_DOCKER_ROOT_DIR"
|
||||||
|
"EFKA_MNESIA_DIR"
|
||||||
|
)
|
||||||
|
|
||||||
TEMP_FILES=()
|
TEMP_FILES=()
|
||||||
INSTALLED_SERVICES=()
|
INSTALLED_SERVICES=()
|
||||||
|
|
||||||
@ -68,6 +99,10 @@ Options:
|
|||||||
Array config inside script:
|
Array config inside script:
|
||||||
INSTALL_IOT
|
INSTALL_IOT
|
||||||
INSTALL_EFKA
|
INSTALL_EFKA
|
||||||
|
IOT_ENV
|
||||||
|
EFKA_ENV
|
||||||
|
IOT_DIR_ENV_KEYS
|
||||||
|
EFKA_DIR_ENV_KEYS
|
||||||
|
|
||||||
Package format:
|
Package format:
|
||||||
INSTALL_<APP>=(
|
INSTALL_<APP>=(
|
||||||
@ -298,54 +333,54 @@ validate_environment_line() {
|
|||||||
|
|
||||||
service_env_lines() {
|
service_env_lines() {
|
||||||
local service_name="$1"
|
local service_name="$1"
|
||||||
|
local env_array_name=""
|
||||||
|
local env_count
|
||||||
|
local index
|
||||||
|
local env_line
|
||||||
|
|
||||||
case "$service_name" in
|
case "$service_name" in
|
||||||
iot)
|
iot)
|
||||||
cat <<'EOF'
|
env_array_name="IOT_ENV"
|
||||||
IOT_API_URL=http://127.0.0.1/api/v1
|
|
||||||
ENDPOINT_ROOT_DIR=/var/lib/endpoint/database/
|
|
||||||
ENDPOINT_LOG_PATH=/var/lib/endpoint/endpoint_log
|
|
||||||
IOT_MNESIA_DIR=/var/lib/iot/mnesia/
|
|
||||||
EOF
|
|
||||||
;;
|
;;
|
||||||
efka)
|
efka)
|
||||||
cat <<'EOF'
|
env_array_name="EFKA_ENV"
|
||||||
EFKA_DETS_DIR=/var/lib/efka/dets/
|
|
||||||
EFKA_IOT_HOST=localhost
|
|
||||||
EFKA_AUTH_UUID=qbxmjyzrkpntfgswaevodhluicqzxplkm
|
|
||||||
EFKA_AUTH_TOKEN=zpxlkvmqwnbghytrujsdieofazxcvbnm
|
|
||||||
EFKA_DOCKER_ROOT_DIR=/var/lib/efka/docker/
|
|
||||||
EFKA_MNESIA_DIR=/var/lib/efka/mnesia
|
|
||||||
EOF
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
eval "env_count=\${#${env_array_name}[@]}"
|
||||||
|
for ((index=0; index<env_count; index++)); do
|
||||||
|
eval "env_line=\"\${${env_array_name}[$index]}\""
|
||||||
|
printf '%s\n' "$env_line"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
service_dir_env_keys() {
|
service_dir_env_keys() {
|
||||||
local service_name="$1"
|
local service_name="$1"
|
||||||
|
local dir_keys_array_name=""
|
||||||
|
local dir_keys_count
|
||||||
|
local index
|
||||||
|
local env_key
|
||||||
|
|
||||||
case "$service_name" in
|
case "$service_name" in
|
||||||
iot)
|
iot)
|
||||||
cat <<'EOF'
|
dir_keys_array_name="IOT_DIR_ENV_KEYS"
|
||||||
ENDPOINT_ROOT_DIR
|
|
||||||
ENDPOINT_LOG_PATH
|
|
||||||
IOT_MNESIA_DIR
|
|
||||||
EOF
|
|
||||||
;;
|
;;
|
||||||
efka)
|
efka)
|
||||||
cat <<'EOF'
|
dir_keys_array_name="EFKA_DIR_ENV_KEYS"
|
||||||
EFKA_DETS_DIR
|
|
||||||
EFKA_DOCKER_ROOT_DIR
|
|
||||||
EFKA_MNESIA_DIR
|
|
||||||
EOF
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
eval "dir_keys_count=\${#${dir_keys_array_name}[@]}"
|
||||||
|
for ((index=0; index<dir_keys_count; index++)); do
|
||||||
|
eval "env_key=\"\${${dir_keys_array_name}[$index]}\""
|
||||||
|
printf '%s\n' "$env_key"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
env_value_for_key() {
|
env_value_for_key() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user