diff options
Diffstat (limited to 'backend')
-rwxr-xr-x | backend/cargohold-cli | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/backend/cargohold-cli b/backend/cargohold-cli index 99c7caa..23f5c19 100755 --- a/backend/cargohold-cli +++ b/backend/cargohold-cli @@ -1,5 +1,6 @@ #!/usr/bin/env bash -DATABASE=cargohold.db3 +DATABASE=${DATABASE:-cargohold.db3} +BASEURL=${BASEURL:-https://files.stumpf.es} usage(){ printf "This utility can be used to manage the cargohold database from the command line\n\n" @@ -35,7 +36,7 @@ addalias(){ fi alias=${4:-$(xxd -g 0 -l 16 -p /dev/urandom)} - printf "Adding alias %s pointing to %s (ACL %s, User %s)\n" "$alias" "$2" "$3" "$1" + printf "Adding alias %s/%s pointing to %s (ACL %s, User %s)\n" "$BASEURL" "$alias" "$2" "$3" "$1" sqlite3 "$DATABASE" "PRAGMA foreign_keys = ON; INSERT INTO aliases (alias, user, real, access) VALUES ('$alias', '$1', '$2', '$3');" } @@ -44,7 +45,7 @@ list(){ sqlite3 -column -header "$DATABASE" "SELECT name, storage FROM users;" printf "\nListing all aliases\n" - sqlite3 -column "$DATABASE" "SELECT user || ': ' || alias || ' (' || access || ') -> ' || real FROM aliases;" + sqlite3 -column "$DATABASE" "SELECT user || ': ' || '$BASEURL/' || alias || ' (' || access || ') -> ' || real FROM aliases;" } if [ "$#" -lt 1 ]; then |