mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-01 06:26:53 +00:00
chore(nix/package/dcoker/aio/env-processor): refactor
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
{
|
||||
writeShellApplication,
|
||||
coreutils,
|
||||
s6-portable-utils,
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "env-processor";
|
||||
|
||||
runtimeInputs = [ coreutils ];
|
||||
runtimeInputs = [
|
||||
coreutils
|
||||
s6-portable-utils
|
||||
];
|
||||
|
||||
text = builtins.readFile ./env_processor.sh;
|
||||
}
|
||||
|
||||
@@ -3,23 +3,59 @@
|
||||
envs_docker_def=' HOME HOSTNAME OLDPWD PATH PORT PWD SHLVL TERM '
|
||||
aio_env_prefix='aio_'
|
||||
nocodb_env_path='/run/nocodb.env'
|
||||
kernal_env_path='/run/kernalenvs'
|
||||
kernal_env_store_dir="/run/kernelenvs"
|
||||
|
||||
aio_postgres_enable=true
|
||||
aio_minio_enable=true
|
||||
|
||||
env_passthrough() {
|
||||
for kenv in "$kernal_env_path"/*; do
|
||||
for key in "$kernal_env_store_dir"/*; do
|
||||
# ignore aio envs
|
||||
case "$kenv" in
|
||||
case "$key" in
|
||||
"$aio_env_prefix"*) continue ;;
|
||||
esac
|
||||
|
||||
# ignore default docker envs
|
||||
case "$envs_docker_def" in
|
||||
*" $kenv "*) continue ;;
|
||||
*" $key "*) continue ;;
|
||||
esac
|
||||
|
||||
echo "$kenv=$(cat "$kernal_env_path/$kenv")" >> "$nocodb_env_path"
|
||||
value="$(cat "$kernal_env_store_dir/$key")"
|
||||
done
|
||||
}
|
||||
|
||||
env_aio_set() {
|
||||
for key in "$kernal_env_store_dir"/*; do
|
||||
case "$key" in
|
||||
"$aio_env_prefix"*) : ;;
|
||||
*) continue ;
|
||||
esac
|
||||
value="$(cat "$kernal_env_store_dir/$key")"
|
||||
|
||||
case "$key" in
|
||||
aio_postgres_enable) aio_postgres_enable="$value" ;;
|
||||
aio_minio_enable) aio_minio_enable="$value" ;;
|
||||
*) echo env processor: ignoring unknown env "$key"
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
env_aio_act() {
|
||||
# TODO
|
||||
"$aio_postgres_enable" &&
|
||||
:
|
||||
|
||||
"$aio_minio_enable" &&
|
||||
:
|
||||
}
|
||||
|
||||
##########
|
||||
## MAIN ##
|
||||
##########
|
||||
|
||||
touch "$nocodb_env_path"
|
||||
|
||||
s6-dumpenv "$kernal_env_store_dir"
|
||||
env_passthrough
|
||||
env_aio_set
|
||||
env_aio_act
|
||||
|
||||
Reference in New Issue
Block a user