Environment Variables Configuration Guide

Rin requires two types of environment variables: Variables (plaintext) and Secrets (encrypted).

Quick Reference

TypeStoragePurposeExamples
VariablesPlaintext in wrangler.tomlConfiguration parameters, feature flagsBucket name, cache mode
SecretsEncrypted in CloudflareSensitive credentials, keysAPI keys, passwords, tokens

Variables (Plaintext)

These variables are stored in plaintext in wrangler.toml and control feature flags and basic parameters.

Site Configuration

VariableRequiredDescriptionDefaultConfig Key
NAMENoSite name & titleRinsite.name
DESCRIPTIONNoSite descriptionA lightweight personal blogging systemsite.description
AVATARNoSite avatar URL-site.avatar
PAGE_SIZENoDefault pagination size5site.page_size
RSS_ENABLENoEnable RSS linkfalserss
Tip

Site configuration can be modified via the Settings Page after deployment. Environment variables serve as initial defaults only.

Storage Configuration

VariableRequiredDescriptionDefaultExample
S3_FOLDERYesImage storage pathimages/images/
S3_CACHE_FOLDERNoCache file pathcache/cache/
S3_BUCKETYesS3 bucket name-my-bucket
S3_REGIONYesS3 region (use 'auto' for R2)-auto
S3_ENDPOINTYesS3 endpoint URL-https://xxx.r2.cloudflarestorage.com
S3_ACCESS_HOSTNoPublic access URLSame as S3_ENDPOINThttps://cdn.example.com
S3_FORCE_PATH_STYLENoForce path-style URLsfalsefalse

Feature Flags

VariableRequiredDescriptionDefaultRecommended
CACHE_STORAGE_MODENoCache mode: s3/databases3database
WEBHOOK_URLNoComment notification webhook--
RSS_TITLENoRSS feed title--
RSS_DESCRIPTIONNoRSS feed description--
For New Users

We recommend setting CACHE_STORAGE_MODE to database to reduce deployment complexity without additional S3 cache configuration.


Secrets (Encrypted)

These sensitive values must be configured as Cloudflare Workers Secrets, entered via CLI during deployment or set in advance.

Authentication (Configure at least one)

VariablePurposeHow to Obtain
RIN_GITHUB_CLIENT_IDGitHub OAuth client IDGitHub OAuth App settings
RIN_GITHUB_CLIENT_SECRETGitHub OAuth client secretGitHub OAuth App settings
ADMIN_USERNAMEUsername for password loginSet yourself
ADMIN_PASSWORDPassword for password loginSet yourself
JWT_SECRETJWT signing key (any random string)Generate yourself
Authentication Required

You must configure either GitHub OAuth or Username/Password authentication, otherwise you cannot access the admin panel.

S3 Storage Credentials

VariablePurposeHow to Obtain
S3_ACCESS_KEY_IDS3 access key IDR2 API Token ID
S3_SECRET_ACCESS_KEYS3 secret access keyR2 API Token

Cloudflare Deployment Credentials

VariablePurposeHow to Obtain
CLOUDFLARE_API_TOKENCloudflare API access tokenCloudflare Dashboard → My Profile → API Tokens
CLOUDFLARE_ACCOUNT_IDCloudflare account IDRight sidebar in Cloudflare Dashboard

GitHub Actions Variables

When using GitHub Actions for automated deployment, configure these in your Repository settings:

Repository Variables (Settings → Secrets and variables → Variables)

NAME                    # Site name
DESCRIPTION             # Site description
AVATAR                  # Site avatar URL
PAGE_SIZE               # Pagination size
RSS_ENABLE              # Enable RSS
CACHE_STORAGE_MODE      # Cache mode (recommended: database)
R2_BUCKET_NAME          # R2 bucket name (optional)
WORKER_NAME             # Worker name (optional)
DB_NAME                 # D1 database name (optional)

Repository Secrets (Settings → Secrets and variables → Secrets)

CLOUDFLARE_API_TOKEN          # Cloudflare API token
CLOUDFLARE_ACCOUNT_ID         # Cloudflare account ID
S3_ENDPOINT                   # S3/R2 endpoint URL
S3_ACCESS_HOST                # S3/R2 access domain
S3_BUCKET                     # S3 bucket name
S3_ACCESS_KEY_ID              # S3 access key ID
S3_SECRET_ACCESS_KEY          # S3 secret access key
RIN_GITHUB_CLIENT_ID          # GitHub OAuth ID (optional)
RIN_GITHUB_CLIENT_SECRET      # GitHub OAuth Secret (optional)
ADMIN_USERNAME                # Admin username (optional)
ADMIN_PASSWORD                # Admin password (optional)
JWT_SECRET                    # JWT secret key

Local Development Environment

For local development, use .env file (see .env.example):

# Site Configuration
NAME="My Blog"
DESCRIPTION="A personal blog"

# S3 Storage (R2 or MinIO)
S3_ENDPOINT=https://xxx.r2.cloudflarestorage.com
S3_BUCKET=my-bucket
S3_ACCESS_KEY_ID=xxx
S3_SECRET_ACCESS_KEY=xxx

# Authentication (GitHub or Username/Password)
RIN_GITHUB_CLIENT_ID=xxx
RIN_GITHUB_CLIENT_SECRET=xxx
# OR
ADMIN_USERNAME=admin
ADMIN_PASSWORD=secure_password

# Others
JWT_SECRET=random_secret_key
CACHE_STORAGE_MODE=database