Config
이 콘텐츠는 아직 번역되지 않았습니다.
Defined in: src/config/Config.ts:137
Accessors
Section titled “Accessors”[CONFIG_BRAND]
Section titled “[CONFIG_BRAND]”Get Signature
Section titled “Get Signature”get [CONFIG_BRAND]():
true
Defined in: src/config/Config.ts:174
The brand — see CONFIG_BRAND. On the prototype, so it is never an own key.
Returns
Section titled “Returns”true
Methods
Section titled “Methods”atPath()
Section titled “atPath()”atPath(
path):Config
Defined in: src/config/Config.ts:588
Wrap the tree under the given path: {a:{b:1}}.atPath(“x.y”) → {x:{y:{a:{b:1}}}}.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Config
getBoolean()
Section titled “getBoolean()”getBoolean(
path):boolean
Defined in: src/config/Config.ts:503
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
getBytes()
Section titled “getBytes()”getBytes(
path):number
Defined in: src/config/Config.ts:531
Byte count: a whole number of bytes.
A bare number never reaches parseSize, which refuses a size that is not
whole, so the number branch checks it here — where, unlike the parser, it
can name the key. It used to hand a bare 10.5 back as it was (#1728).
The check comes after requireFinite and passes Infinity, the size that
function lets through at the one key documenting it as “no cap”.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
getConfig()
Section titled “getConfig()”getConfig(
path):Config
Defined in: src/config/Config.ts:566
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Config
getDuration()
Section titled “getDuration()”getDuration(
path):number
Defined in: src/config/Config.ts:515
Duration in milliseconds.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
getInt()
Section titled “getInt()”getInt(
path):number
Defined in: src/config/Config.ts:482
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
getList()
Section titled “getList()”getList(
path):ConfigValue[]
Defined in: src/config/Config.ts:554
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”getNumber()
Section titled “getNumber()”getNumber(
path):number
Defined in: src/config/Config.ts:488
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
getObject()
Section titled “getObject()”getObject(
path):ConfigObject
Defined in: src/config/Config.ts:560
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”getString()
Section titled “getString()”getString(
path):string
Defined in: src/config/Config.ts:475
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string
getStringList()
Section titled “getStringList()”getStringList(
path):string[]
Defined in: src/config/Config.ts:544
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string[]
hasPath()
Section titled “hasPath()”hasPath(
path):boolean
Defined in: src/config/Config.ts:455
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
merge()
Section titled “merge()”merge(
overlay):Config
Defined in: src/config/Config.ts:582
Inverse of withFallback — layer overlay on top.
Parameters
Section titled “Parameters”overlay
Section titled “overlay”Config
Returns
Section titled “Returns”Config
toJSON()
Section titled “toJSON()”toJSON():
ConfigObject
Defined in: src/config/Config.ts:631
Returns
Section titled “Returns”withFallback()
Section titled “withFallback()”withFallback(
other):Config
Defined in: src/config/Config.ts:576
Merge other underneath this config — i.e. values defined here win,
keys that only exist in other are filled in.
Parameters
Section titled “Parameters”Config
Returns
Section titled “Returns”Config
empty()
Section titled “empty()”
staticempty():Config
Defined in: src/config/Config.ts:178
Returns
Section titled “Returns”Config
fromObject()
Section titled “fromObject()”
staticfromObject(obj):Config
Defined in: src/config/Config.ts:209
A config built from a plain object of overrides.
This copy’s own Config comes back as it is. Anything else that is not a
plain object is refused, because the fallback used to be worse than an
error: a class instance passed the plain-object test, its own fields were
read as the tree, and the keys the caller meant went unread without a word
— an empty Map is an empty config. A Config built by another copy of
actor-ts is the case that matters, and it gets its own message, since its
layers and the secret paths the boot dump withholds are private to the
copy that built it: reading only its tree could print a secrets-file value
in clear text.
The same defect had two more routes, closed here for every caller —
ActorSystemOptions.withConfig and Config.load({ overrides }) among
them (#1473). A spread of a Config ({ ...config }) passes the
plain-object test, because the brand sits on the prototype a spread does
not copy, and is refused by name; and a class instance below the top
level is refused, naming its path, as one at the top level is.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Config
load()
Section titled “load()”
staticload(options?):Config
Defined in: src/config/Config.ts:311
Load the standard config chain. Precedence (highest first):
overridespassed in code.- The secrets file’s active profile — its
profiles.<profile>block. - The secrets file, resolved via
secretsConfPath→process.env.ACTOR_TS_SECRETS_CONF→./secrets.confin CWD. - The application file’s active profile.
application.confresolved viaappConfPath→process.env.ACTOR_TS_CONFIG→./application.confin CWD.- The project
reference.conf’s active profile. - The project’s own
reference.conf, resolved viareferenceConfPath→process.env.ACTOR_TS_REFERENCE_CONFIG→./reference.confin CWD (#1785). reference.confbundled with this package.
The profile is profile → process.env.ACTOR_TS_PROFILE → none, and a
name no file defines is refused rather than read as “no overlay”. Every
file is optional: a path with no file behind it is an empty layer, and
false for a path reads no such file at all. A file that is there and
cannot be loaded is refused naming the file and what made load read it
— the files in the working directory are read whenever nothing names
others.
Substitutions read, in order: the file’s own keys, with its active
profile laid over its root before they resolve — so an alias in the root
follows the profile, and an inactive profile is never resolved at all —
then the resolved layers beneath it, then the real environment, then the
variables of a .env file (#1785). Downward only: application.conf may
read a key the project reference.conf sets, but a lower file never sees
a higher one, so there is no late binding and each layer still holds
exactly what its file produced. The .env file is found through the
option, then the real ACTOR_TS_ENV_FILE, then ./.env, and may itself
name the other files and the profile; it never writes process.env.
Parameters
Section titled “Parameters”options?
Section titled “options?”LoadOptions = {}
Returns
Section titled “Returns”Config
loadReference()
Section titled “loadReference()”
staticloadReference():Config
Defined in: src/config/Config.ts:447
Returns
Section titled “Returns”Config
parseFile()
Section titled “parseFile()”
staticparseFile(path):Config
Defined in: src/config/Config.ts:185
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Config
parseString()
Section titled “parseString()”
staticparseString(source):Config
Defined in: src/config/Config.ts:180
Parameters
Section titled “Parameters”source
Section titled “source”string
Returns
Section titled “Returns”Config
