Back to docs

Environment Variables

Storage UI reads all server-side settings from environment variables. Storage credentials stay on the server and are never shipped to the browser.

For local development, copy the example file and edit it:

cp .env.example .env.local

On a hosting platform (Vercel, Docker, etc.), set the same variables in that platform's environment settings.

Application

VariableDefaultDescription
NEXT_PUBLIC_APP_URLlocalhost:3000Public URL of the app.
NEXT_PUBLIC_BASE_PATH(root)

Serve from a subpath, e.g. /drive. Also redirects / to that path.

NEXT_PUBLIC_ASSET_PREFIX(none)Set only when static assets are served from a separate origin.

Authentication

Set a username and password to turn on the built-in login screen. Leave either blank to keep the app open.

AUTH_USERNAME=admin
AUTH_PASSWORD=change-me
AUTH_SECRET=a-long-random-string
VariableRequiredDescription
AUTH_USERNAMEFor loginLogin username.
AUTH_PASSWORDFor loginLogin password.
AUTH_SECRETRecommended

Signs the session cookie. Without it, the password doubles as the signing key, so changing the password logs everyone out.

Sessions last 7 days.

Storage connections

Each connection is a numbered group of variables, STORAGE_1_* through STORAGE_50_*. Users can still add more connections from the UI at runtime.

A connection loads once its BUCKET, ACCESS_KEY_ID, and SECRET_ACCESS_KEY are set (plus REGION or ENDPOINT for some providers, noted below).

VariableRequiredDescription
STORAGE_n_BUCKETYesBucket name.
STORAGE_n_ACCESS_KEY_IDYesAccess key ID (Tencent SecretId, B2 key ID).
STORAGE_n_SECRET_ACCESS_KEYYesSecret access key (Tencent SecretKey, B2 application key).
STORAGE_n_PROVIDER

No (s3)

Provider, see list below.
STORAGE_n_NAMENoDisplay name in the sidebar. Defaults to the bucket name.
STORAGE_n_REGIONProvider

Required for alibaba, tencent, backblaze-b2. Ignored by r2. Defaults to auto for S3.

STORAGE_n_ENDPOINTProvider

Required for minio. Optional override for other S3-compatible providers.

STORAGE_n_ACCOUNT_IDR2 onlyCloudflare account ID (R2 derives its endpoint from this).
STORAGE_n_FORCE_PATH_STYLENo

Path-style addressing. Defaults to true for minio, false otherwise.

STORAGE_n_PUBLIC_BASE_URLNoPublic or CDN base URL for file links.
STORAGE_n_READ_ONLYNo

Set to true to disable all edits for this bucket.

Supported providers: s3, r2, alibaba, tencent, backblaze-b2, minio, s3-compatible.

Examples

Always set a real region.

STORAGE_1_PROVIDER=s3
STORAGE_1_NAME=Production
STORAGE_1_BUCKET=my-bucket
STORAGE_1_REGION=us-east-1
STORAGE_1_ACCESS_KEY_ID=...
STORAGE_1_SECRET_ACCESS_KEY=...