Files
admin/apps/backend/start/env.ts
T

47 lines
1.7 KiB
TypeScript
Executable File

/*
|--------------------------------------------------------------------------
| Environment variables service
|--------------------------------------------------------------------------
|
| The `Env.create` method creates an instance of the Env service. The
| service validates the environment variables and also cast values
| to JavaScript data types.
|
*/
import { Env } from '@adonisjs/core/env'
export default await Env.create(new URL('../', import.meta.url), {
NODE_ENV: Env.schema.enum(['development', 'production', 'test'] as const),
PORT: Env.schema.number(),
APP_KEY: Env.schema.string(),
HOST: Env.schema.string({ format: 'host' }),
LOG_LEVEL: Env.schema.enum(['fatal', 'error', 'warn', 'info', 'debug', 'trace']),
/*
|----------------------------------------------------------
| Variables for configuring database connection
|----------------------------------------------------------
*/
DB_HOST: Env.schema.string({ format: 'host' }),
DB_PORT: Env.schema.number(),
DB_USER: Env.schema.string(),
DB_PASSWORD: Env.schema.string.optional(),
DB_DATABASE: Env.schema.string(),
/*
|----------------------------------------------------------
| Variables for public web app cache revalidation
|----------------------------------------------------------
*/
WEB_APP_URL: Env.schema.string.optional({ format: 'url', tld: false }),
WEB_REVALIDATE_SECRET: Env.schema.string.optional(),
DRIVE_DISK: Env.schema.enum(['fs', 's3'] as const),
AWS_ACCESS_KEY_ID: Env.schema.string.optional(),
AWS_SECRET_ACCESS_KEY: Env.schema.string.optional(),
AWS_REGION: Env.schema.string.optional(),
S3_BUCKET: Env.schema.string.optional(),
S3_ENDPOINT: Env.schema.string.optional(),
S3_CDN_URL: Env.schema.string.optional(),
})