Something went wrong. Try again.
Full document, spreadsheet, slideshow, and diagram tooling
Something went wrong. Try again.
atmosphere-office docker-entrypoint.sh
1.2 kB · 46 lines
Shell
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#!/bin/shset -e
# Generate /srv/instance-info.json from environment variables.# If INSTANCE_FLAVOR is not set, the baked-in file from the build is used as-is.
if [ -n "$INSTANCE_FLAVOR" ]; then SYNC=false; SHARING=false; AI=false case ",$INSTANCE_FEATURES," in *,sync,*) SYNC=true;; esac case ",$INSTANCE_FEATURES," in *,sharing,*) SHARING=true;; esac case ",$INSTANCE_FEATURES," in *,ai,*) AI=true;; esac
OP=null [ -n "$INSTANCE_OPERATOR" ] && OP="\"$INSTANCE_OPERATOR\""
PDS=null [ -n "$INSTANCE_PDS" ] && PDS="\"$INSTANCE_PDS\""
NOTICE=null [ -n "$INSTANCE_NOTICE" ] && NOTICE="\"$INSTANCE_NOTICE\""
AC=null if [ "$INSTANCE_ACCESS_MODE" = "allowlist" ] && [ -n "$INSTANCE_ALLOWLIST" ]; then DIDS=$(printf '%s' "$INSTANCE_ALLOWLIST" | sed 's/,/","/g') AC="{\"mode\":\"allowlist\",\"allowlist\":[\"$DIDS\"]}" elif [ "$INSTANCE_ACCESS_MODE" = "open" ]; then AC="{\"mode\":\"open\"}" fi
cat > /srv/instance-info.json <<EOF{ "flavor": "$INSTANCE_FLAVOR", "operator": $OP, "pds": $PDS, "features": { "sync": $SYNC, "sharing": $SHARING, "ai": $AI }, "notice": $NOTICE, "accessControl": $AC}EOFfi
exec "$@"