Interface MemcoOptions
logLevel?: string;
token?: string;
host?: string;
tls?: boolean;
timeout?: number;
env?: Readonly<Record<string, string | undefined>>;
}
Hierarchy
- ResolveOptions
- MemcoOptions
Properties
OptionallogLevel
Log level to apply before anything else happens, one of critical,
error, warning, info, debug, or none to silence the SDK.
Setting it is process-wide, because a logger is. Prefer the MEMCO_LOG
environment variable in an application that has its own logging: it says
the same thing without a library reaching into global state on the
application's behalf.
Optionaltoken
Credential to authenticate with. When omitted, MEMCO_API_TOKEN is used,
falling back to the deprecated MEMCO_API_KEY with a warning. A blank
value is refused rather than treated as absent.
Optionalhost
Service endpoint, optionally including a port such as localhost:50051 or
[2001:db8::1]:50051. When omitted, MEMCO_API_HOST is used, falling back
to DEFAULT_HOST. A host without a port gets DEFAULT_PORT. A
blank value is refused rather than treated as absent.
Optionaltls
Whether to dial over TLS with the system trust store. Set to false only
for a plaintext endpoint, such as a local server.
Optionaltimeout
Default per-call deadline in seconds.
Optionalenv
Environment to read from. Defaults to process.env; supplying one is
mainly useful in tests.
Settings for a Memco, every one of them optional.
An argument always wins over the environment, and the environment over the built-in default. Three settings have an environment variable behind them:
tokenreadsMEMCO_API_TOKEN— falling back to the deprecatedMEMCO_API_KEY, which warns —hostreadsMEMCO_API_HOST, andlogLevelreadsMEMCO_LOG. The rest fall straight through to their built-in values — TLS on, and DEFAULT_TIMEOUT seconds as the deadline every call inherits. The credential is the one connection setting with no default at all: a client that finds none is refused rather than left to fail on its first call.All of it is resolved by the constructor, before a socket is opened, so a blank host, an unparseable port or a timeout that is not a positive number is a MemcoConfigError out of
new Memco(...)rather than a transport failure later on.MemcoOptions.logLevel is the odd one out: everything else here configures this client, and that configures the process.