added validation, fixed ref

pull/78/head
Stephen Kirby 2 years ago
parent 5a8b8763cb
commit d6e7363e39

@ -18,7 +18,11 @@ variable "agent_id" {
variable "db_path" { variable "db_path" {
type = string type = string
description = "The path to the filebrowser database." description = "The path to the filebrowser database."
default = "" default = "filebrowser.db"
validation {
condition = ends_with(var.database_path, "filebrowser.db")
error_message = "The database_path must end with 'filebrowser.db'."
}
} }
variable "log_path" { variable "log_path" {

@ -14,9 +14,8 @@ ROOT_DIR=$${ROOT_DIR/\~/$HOME}
# Set the database flag if DB_PATH is set # Set the database flag if DB_PATH is set
DB_FLAG="" DB_FLAG=""
if [ -z "${DB_PATH}" ]; then if [ "${DB_PATH}" != "filebrowser.db" ]; then
echo "DB_PATH is empty" echo ">>> flag set!"
else
DB_FLAG="-d ${DB_PATH}" DB_FLAG="-d ${DB_PATH}"
fi fi
@ -24,6 +23,6 @@ printf "📂 Serving $${ROOT_DIR} at http://localhost:${PORT} \n\n"
printf "Running 'filebrowser --noauth --root $ROOT_DIR --port ${PORT}$${DB_FLAG}' \n\n" # -d ${DB_PATH} printf "Running 'filebrowser --noauth --root $ROOT_DIR --port ${PORT}$${DB_FLAG}' \n\n" # -d ${DB_PATH}
filebrowser --noauth --root $ROOT_DIR --port ${PORT} >${LOG_PATH}$${DB_FLAG} 2>&1 & # -d ${DB_PATH} filebrowser --noauth --root $ROOT_DIR --port ${PORT}${DB_FLAG} >${LOG_PATH} 2>&1 & # -d ${DB_PATH}
printf "📝 Logs at ${LOG_PATH} \n\n" printf "📝 Logs at ${LOG_PATH} \n\n"

Loading…
Cancel
Save