본문으로 건너뛰기

Configuration

Docunara is configured through environment variables defined in the .env file at the project root. Copy .env.example to .env to get started:

cp .env.example .env
.env Comment Syntax

The dotenv library reads inline comments (e.g., VALUE=foo # comment) as part of the value. Always place comments on a separate line above the variable, never after the value on the same line.

# This is the correct way to comment
PORT=3000

PORT=3000 # This comment becomes part of the value — WRONG

Server Port Settings

VariableDefaultDescription
PORT3000Docusaurus development server port
API_PORT3001Docunara API server port

Legacy Authentication

When the database is disabled (DB_ENABLED=false), you can use a shared bearer token for API authentication instead of username/password login:

VariableDefaultDescription
EDITOR_SECRET(empty)Shared bearer token for API access. Only applies when DB_ENABLED=false and ADMIN_PASSWORD is not set. Clients include this token in the Authorization: Bearer <token> header.
Authentication Priority

When DB_ENABLED=false, the authentication mode is determined in this order:

  1. If ADMIN_PASSWORD is set → JWT-based login (admin ID or email)
  2. Else if EDITOR_SECRET is set → Bearer token authentication
  3. Else → open access (no authentication)

Admin Account

The admin account is used for editor authentication in all modes. Users can log in with either their ID or email.

VariableDefaultDescription
ADMIN_ID(empty)Admin login ID (e.g., admin)
ADMIN_EMAIL(empty)Admin email address
ADMIN_PASSWORD(empty)Admin password. If empty and EDITOR_SECRET is also empty, no authentication is required.

When DB_ENABLED=false:

  • ADMIN_PASSWORD empty and EDITOR_SECRET empty → editor is open to anyone (no authentication)
  • ADMIN_PASSWORD set → login is required; user can log in with ADMIN_ID or ADMIN_EMAIL
  • EDITOR_SECRET set (without ADMIN_PASSWORD) → API requires the bearer token

When DB_ENABLED=true:

  • An admin account is created in the database on first run using these credentials
  • This is the only account available unless a valid license enables user management

Change the default admin credentials immediately in production environments.

Database Settings

Enable SQLite for document search:

VariableDefaultDescription
DB_ENABLEDfalseSet to true to enable SQLite database and search
DB_PATH./data/editor.dbPath to the SQLite database file
JWT_SECRETSecret key for signing JWT tokens. Must be changed in production.
JWT_EXPIRES_IN1hAccess token expiration duration
JWT_REFRESH_EXPIRES_IN7dRefresh token expiration duration

What the Database Enables

  • Document search — full-text search across all documentation files
  • JWT authentication — secure token-based auth (replaces simple credential check)

Enabling the Database

  1. Set DB_ENABLED=true in your .env file
  2. Set a strong, unique JWT_SECRET value
  3. Configure the admin account credentials
  4. Start the server — the database and tables are created automatically

License Settings

VariableDefaultDescription
LICENSE_FILE(empty)Path to a license certificate file. Required for premium features (user management, alternative DB backends).

See Licensing for details on the license policy.

AI Chat Settings

Configure the built-in AI writing assistant. AI Chat is enabled automatically when an API key is provided.

VariableDefaultDescription
AI_PROVIDERopenaiAI provider: openai or anthropic
AI_APIKEY(empty)API key for the AI provider. AI Chat is disabled when empty.
AI_MODEL(auto)Model name. Defaults to gpt-4o-mini (OpenAI) or claude-sonnet-4-20250514 (Anthropic).
AI_SYSPROMPT(built-in)Custom system prompt for the AI assistant. Uses a documentation-focused default when empty.

See AI Chat for usage details and feature availability.

Feature Availability Summary

ConfigurationAuth MethodSearchUser Management
DB_ENABLED=false, no password, no secretNo authenticationNoNo
DB_ENABLED=false, EDITOR_SECRET setBearer tokenNoNo
DB_ENABLED=false, ADMIN_PASSWORD setJWT (admin ID or email login)NoNo
DB_ENABLED=trueJWT (admin only)YesNo
DB_ENABLED=true + valid LICENSE_FILEJWT (multi-user)YesYes

Example .env File

# Server Ports
PORT=3000
API_PORT=3001

# Legacy bearer token (only when DB_ENABLED=false and no ADMIN_PASSWORD)
EDITOR_SECRET=

# Database
DB_ENABLED=true
DB_PATH=./data/editor.db

# JWT (change in production!)
JWT_SECRET=my-secure-random-secret-key
JWT_EXPIRES_IN=1h
JWT_REFRESH_EXPIRES_IN=7d

# Admin Account
ADMIN_ID=admin
ADMIN_EMAIL=admin@mycompany.com
ADMIN_PASSWORD=change-me-immediately

# License certificate (empty = development mode)
LICENSE_FILE=

# AI Chat
AI_PROVIDER=openai
AI_APIKEY=
AI_MODEL=
AI_SYSPROMPT=