Skip to main content

Interface: Environment

Defined in: packages/core/src/boot.ts:63

App environment for single env key.

The production environment is used as a base template for other environment configurations. Meaning that all dev or test env definitions are deeply merged into prod base config.

So you can only define other-env specific overrides without the need to re-define whole custom configuration.

Indexable

[key: string]: unknown

Properties

$App?

optional $App: $AppSettings

Defined in: packages/core/src/boot.ts:89


$Debug?

optional $Debug: boolean

Defined in: packages/core/src/boot.ts:70

Enable/disable debug mode. When enabled you can see additional error messages while this also enable some additional validation that can produce additional errors.


$Language?

optional $Language: Record<string, string>

Defined in: packages/core/src/boot.ts:87


$Resources()?

optional $Resources: (response, manifest, defaultResources) => Resources

Defined in: packages/core/src/boot.ts:90

Parameters

response

unknown

manifest

Manifest

defaultResources

Resources

Returns

Resources


$Server?

optional $Server: object

Defined in: packages/core/src/boot.ts:95

cache?

optional cache: object

Cache configuration.

cache.cacheKeyGenerator()?

optional cacheKeyGenerator: (req) => string

Cache key generator function.

Parameters
req

Request

Returns

string

cache.enabled?

optional enabled: boolean | (req) => boolean

Enable/disable cache for the server.

cache.entryTtl?

optional entryTtl: number

The maximum time a cache entry is kept. [ms]

cache.maxEntries?

optional maxEntries: number

The maximum entries in cache.

cache.unusedEntryTtl?

optional unusedEntryTtl: number

The time after which the unused entries are discarded. [ms]

clusters?

optional clusters: number | null

Define the number of server processes you want to start. Use null for the current number of available CPU cores.

concurrency?

optional concurrency: number

The number of application instances (not threads) used to handle concurrent connections within a single thread.

degradation?

optional degradation: object

Degradation functions for the server.

degradation.isOverloaded()?

optional isOverloaded: (event) => boolean

Parameters
event

any

Returns

boolean

degradation.isSPA()?

optional isSPA: (event) => boolean

Parameters
event

any

Returns

boolean

degradation.isSPAPrefetch()?

optional isSPAPrefetch: (event) => boolean

Parameters
event

any

Returns

boolean

degradation.isStatic()?

optional isStatic: (event) => boolean

Parameters
event

any

Returns

boolean

host?

optional host: string | (__namedParameters) => string

When defined it overrides any other host settings in the urlParser hook.

logger?

optional logger: object

logger.formatting?

optional formatting: "dev" | "simple" | "JSON"

Use "simple", "JSON" or "dev". "dev" option produces colorful output with source-mapping of error stacks. This is usefull in development.

port?

optional port: number

The port at which the server listens for incoming HTTP connections

protocol?

optional protocol: "http:" | "https:" | (__namedParameters) => "http:" | "https:"

When defined it overrides any other protocol settings in the urlParser hook.

staticPath?

optional staticPath: string

Base path, which serves static files form the build folder, see https://imajs.io/cli/ima-config-js/#publicpath for more info. Used in staticPath middleware definition in app.js.


$Version

$Version: string

Defined in: packages/core/src/boot.ts:88