Enhance emulator setup with Caddy support and update documentation
- Added Caddyfile example for HTTPS configuration. - Updated README to include Caddy as an optional component. - Modified make-certs.sh to use dynamic account names for certificate generation. - Improved add-account.sh to handle missing accounts.env file gracefully. - Enhanced run-server.sh to support Caddy integration and OAuth options.
This commit is contained in:
@@ -1,22 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Usage: $0 <account-name> [ password ]"
|
||||
exit 1
|
||||
echo "Usage: $0 <account-name> [ password ]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$2" ]]; then
|
||||
PASSWORD=$(openssl rand -base64 32)
|
||||
PASSWORD=$(openssl rand -base64 32)
|
||||
else
|
||||
PASSWORD=$(echo -n "$2" | base64)
|
||||
PASSWORD=$(echo -n "$2" | base64)
|
||||
fi
|
||||
|
||||
AZURITE_DIR="storage"
|
||||
mkdir -p "$AZURITE_DIR"
|
||||
|
||||
AZURITE_ACCOUNTS_FILE="$AZURITE_DIR/accounts.env"
|
||||
. $AZURITE_ACCOUNTS_FILE
|
||||
|
||||
STORAGE_ACCOUNTS=($(echo "$AZURITE_ACCOUNTS" | tr ';' ' '))
|
||||
if [[ -f "$AZURITE_ACCOUNTS_FILE" ]]; then
|
||||
. "$AZURITE_ACCOUNTS_FILE"
|
||||
STORAGE_ACCOUNTS=($(echo "$AZURITE_ACCOUNTS" | tr ';' ' '))
|
||||
else
|
||||
# No accounts file, start with an empty array
|
||||
STORAGE_ACCOUNTS=()
|
||||
fi
|
||||
|
||||
STORAGE_ACCOUNTS+=("$1:$PASSWORD")
|
||||
printf 'AZURITE_ACCOUNTS="%s"\n' $(IFS=';'; echo "${STORAGE_ACCOUNTS[*]}") > "$AZURITE_ACCOUNTS_FILE"
|
||||
|
||||
Reference in New Issue
Block a user