Configuration

Environment

Loading environment variables from .env files.

1 min readDocumentationEdit this page

Usage

typescript
import { loadEnv } from '@axiljs/config'
loadEnv()

.env format

env
PORT=3000
NODE_ENV=development
JWT_SECRET=your-secret-minimum-32-characters
DATABASE_URL=postgres://user:pass@localhost:5432/mydb

Multiple files

typescript
loadEnv({ files: ['.env', '.env.local', '.env.production'] })

Warning

Never commit .env to version control.

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY