1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00
haze/nix/image/scripts/nc-auto-config

36 lines
842 B
Text
Executable file

#!/bin/nu
touch /var/log/nginx/access.log
touch /var/log/nginx/error.log
touch /var/log/cron/owncloud.log
cp /etc/nc/config.php /var/www/html/config/config.php
chmod 0755 /var/www/html/config/config.php
let configName = match $env.SQL {
"oracle" => "oci"
_ => $env.SQL
}
let configPath = $"/etc/nc/autoconfig_($configName).php"
if ($configPath | path exists) {
cp $configPath /var/www/html/config/autoconfig.php
}
def loadExtraConfig [name: string] {
sed -i $'/\/\/PLACEHOLDER/ r /etc/nc/($name).php' /var/www/html/config/config.php
}
let extraConfigs = ["S3", "S3S", "S3MB", "S3M", "SWIFT", "SWIFTV3", "AZURE"];
$extraConfigs | each {
if ($in in $env) {
loadExtraConfig ($in | str downcase)
}
}
if ("REDIS_TLS" in $env) {
loadExtraConfig "redis-tls"
} else {
loadExtraConfig "redis-default"
}