44 lines
1.5 KiB
Fish
44 lines
1.5 KiB
Fish
#!/bin/env fish
|
|
begin
|
|
set -l dir (status dirname)
|
|
set -l domain "passwords"
|
|
set -l source "$dir/docker-compose.overrides.yml"
|
|
source "$dir/../service.fish"
|
|
|
|
function installSW -V dir -V domain -V source
|
|
set -l file "$dir/docker-compose.base.yml"
|
|
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
|
|
set -l envKey ".services.vaultwarden.environment"
|
|
set -l dbKey "$envKey.DATABASE_URL"
|
|
set -l dbUrl (yq "$dbKey" "$source" | sed "s/^\(.*:\/\/.*:\).*\(@.*\/.*\)\$/\1$pw\2/")
|
|
initializeServiceInstallation $argv
|
|
cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
|
|
|
|
URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$source" | \
|
|
ADDRESS="no-reply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" | \
|
|
URL=$dbUrl yq "$dbKey = env(URL)" | \
|
|
PW=$pw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" | \
|
|
sudo tee (getServiceOverrides $argv) >/dev/null
|
|
|
|
installDockerService $argv
|
|
end
|
|
|
|
function configureSW -V dir
|
|
configureDockerService $argv
|
|
end
|
|
|
|
function getServiceServers -V domain
|
|
printf "%s\0" "$domain" ""
|
|
end
|
|
|
|
function getServiceLocations
|
|
argparse -i "name=" -- $argv
|
|
printf "%s\0" "$_flag_name" /
|
|
end
|
|
|
|
function getBackupArgs
|
|
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" (getServiceRoot $argv)
|
|
end
|
|
|
|
runInstaller --force $argv
|
|
end
|