diff options
author | satanist <satanist+git@bureaucracy.de> | 2022-05-08 13:50:28 +0200 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2022-05-08 13:50:28 +0200 |
commit | 1f7c87830776cd422dc93f26e9fe30543ead9104 (patch) | |
tree | 5b7bfcdb38977081e65d391c0deba04d43341f98 /backend | |
parent | 78e06330a0663d07a5c0dde3be398d707b13010f (diff) | |
download | cargohold-1f7c87830776cd422dc93f26e9fe30543ead9104.tar.gz cargohold-1f7c87830776cd422dc93f26e9fe30543ead9104.tar.bz2 cargohold-1f7c87830776cd422dc93f26e9fe30543ead9104.zip |
[PATCH] cargohold-cli: print full url
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 |