Skip to content

.env Configuration ​

Pastefy uses environment variables to configure backend settings, authentication, storage, and integrations. This guide lists all available .env variables, grouped by category, with descriptions and defaults.


1. Server Settings (Required) ​

VariableDescriptionDefault / Notes
HTTP_SERVER_PORTPort the HTTP server listens on80
HTTP_SERVER_CORSAllowed CORS origins*
SERVER_NAMEThe public URL of your Pastefy instancehttp://example.com

2. Database Settings (Required) ​

INFO

Currently only MySQL is supported.

VariableDescriptionDefault / Notes
DATABASE_DRIVERDatabase type (Currently only mysql)mysql
DATABASE_NAMEDatabase namepastefy
DATABASE_USERDatabase usernamepastefy
DATABASE_PASSWORDDatabase passwordpastefy
DATABASE_HOSTDatabase hostlocalhost
DATABASE_PORTDatabase port3306
PASTEFY_AUTOMIGRATEEnable automatic DB migrationtrue

Extra: Optional MySQL Performance Tuning (Optional) ​

VariableDescriptionDefault / Notes
DATABASE_CUSTOMPARAMS_CACHE_PREP_STMTSCache prepared statementstrue
DATABASE_CUSTOMPARAMS_PREP_STMT_CACHE_SIZEPrepared statement cache size250
DATABASE_CUSTOMPARAMS_PREP_STMT_CACHE_SQL_LIMITMax SQL length for prepared statement cache2048
DATABASE_CUSTOMPARAMS_USE_SERVER_PREP_STMTSUse server-side prepared statementstrue
DATABASE_CUSTOMPARAMS_CACHE_RESULT_SET_METADATACache result set metadatatrue
DATABASE_CUSTOMPARAMS_CACHE_SERVER_CONFIGURATIONCache server configurationtrue
DATABASE_CUSTOMPARAMS_MAINTAIN_TIME_STATSMaintain time statisticstrue

3. OAuth / Login Providers (Optional) ​

TIP

You are not required to use a login provider. Pastefy can be used without login as well. And you can configure multiple providers at the same time if wanted.

VariableDescriptionExample / Notes
OAUTH2_INTERAAPPS_CLIENT_IDClient ID for Interaapps logindan3q9n
OAUTH2_INTERAAPPS_CLIENT_SECRETClient secret for Interaapps loginASDFASDF
OAUTH2_TWITCH_CLIENT_IDClient ID for Twitch loginyour-twitch-id
OAUTH2_TWITCH_CLIENT_SECRETClient secret for Twitch loginyour-twitch-secret
OAUTH2_GITHUB_CLIENT_IDClient ID for GitHub loginyour-github-id
OAUTH2_GITHUB_CLIENT_SECRETClient secret for GitHub loginyour-github-secret
OAUTH2_GOOGLE_CLIENT_IDClient ID for Google loginyour-google-id
OAUTH2_GOOGLE_CLIENT_SECRETClient secret for Google loginyour-google-secret
OAUTH2_DISCORD_CLIENT_IDClient ID for Discord loginyour-discord-id
OAUTH2_DISCORD_CLIENT_SECRETClient secret for Discord loginyour-discord-secret
OAUTH2_OIDC_CLIENT_IDClient ID for custom OIDC provideryour-client-id
OAUTH2_OIDC_CLIENT_SECRETClient secret for custom OIDC provideryour-secret
OAUTH2_OIDC_AUTH_ENDPOINTOAuth2 authorization endpointhttps://example.com/auth
OAUTH2_OIDC_TOKEN_ENDPOINTOAuth2 token endpointhttps://example.com/token
OAUTH2_OIDC_USERINFO_ENDPOINTOIDC userinfo endpointhttps://example.com/userinfo

4. Pastefy Access & Features (Optional) ​

VariableDescriptionDefault
PASTEFY_LOGIN_REQUIREDRequire login for all actionsfalse
PASTEFY_LOGIN_REQUIRED_CREATERequire login to create pastesfalse
PASTEFY_LOGIN_REQUIRED_READRequire login to read pastesfalse
PASTEFY_GRANT_ACCESS_REQUIREDRequire admin approval for new accountsfalse
PASTEFY_LIST_PASTESEnable /paste route listing all pastesfalse
PASTEFY_PUBLIC_STATSMake /app/stats publicfalse
PASTEFY_PUBLIC_PASTESShow public pastes sectionfalse
PASTEFY_META_TAGSMeta tags for the instancenone
PASTEFY_CUSTOM_BODYCustom HTML body contentnone
PASTEFY_CUSTOM_HEADERCustom HTML header contentnone
PASTEFY_PAGINATION_PAGE_LIMITPastes per page in paginationnone
PASTEFY_DEVEnable development modefalse

5. Redis (Optional) ​

VariableDescriptionExamples
REDIS_HOSTRedis server host-
REDIS_PORTRedis server port-

6. MinIO / Object Storage (Optional) ​

WARNING

Pastefy does not auto migrate your database to use MinIO/S3. You need to set it up manually and migrate existing pastes if needed. Set up a pastefy instance with MinIO/S3 from the start to avoid migration if you plan to grow.

VariableDescriptionExamples
MINIO_SERVERMinIO / S3 server URLhttps://minio.example.com
MINIO_BUCKETBucket name for Pastefy filespastefy
MINIO_ACCESS_KEYAccess key-
MINIO_SECRET_KEYSecret key-

7. Elasticsearch (Optional) ​

WARNING

Pastefy does not auto migrate your database to use Elasticsearch. You need to set it up manually and migrate existing pastes if needed. Set up a pastefy instance with Elasticsearch from the start to avoid migration if you plan to grow.

VariableDescriptionExample
ELASTICSEARCH_URLElasticsearch server URLhttp://localhost:9200
ELASTICSEARCH_USERUsername for Elasticsearchelastic
ELASTICSEARCH_PASSWORDPassword for Elasticsearchchangeme
ELASTICSEARCH_API_KEYAPI key for Elasticsearchxxx

8. AI / Integrations (Optional) ​

VariableDescriptionNotes
AI_ANTHROPIC_TOKENAPI token for Anthropics AI integration-

✅ Notes ​

  • Can be used in .env or as Docker environment variables.
  • Make sure SERVER_NAME matches your public URL for OAuth redirects.
  • Combine with Docker-Compose or manual deployment depending on your setup.