encore.dev/config
Interfaces
Secret()
Secret represents a single secret value that is loaded into the application. It is strongly typed for that secret, so that you can write functions which expect a specific one.
You can use AnySecret to represent any secret without knowing it's name.
Example
function doFoo(s: Secret<"foo">): void {
const foo = s();
}
Type Parameters
Name
Name extends string
Secret(): string
Returns the current value of the secret.
Encore will periodically refresh the value of the secret, so this
value may change over time and could be stale for upto a couple of
minutes. If you need to ensure you have the latest value, use
latest.
Returns
string
Properties
name
readonly name: Name
The name of the secret.
Type Aliases
AnySecret
type AnySecret = Secret<string>
AnySecret is a type which can be used to represent any Secret without knowing its name.
Functions
secret()
function secret<Name>(name): Secret<Name>
secret is used to load a single Secret into the application.
If you wish to load multiple secrets at once, see secrets.
Type Parameters
Name
Name extends string
Parameters
name
StringLiteral\<Name>
Returns
Secret\<Name>
Example
loading a single secret
import {secret} from "encore.dev/config/secrets";
const foo = secret<"foo">();