Read configuration and secrets from code
Platform configuration holds an application’s settings, globally or per client (tenant): an SMTP host, a partner’s API key, a per-client SFTP password. Administrators manage it in the console; your application reads it at run time with its service account. Secrets are encrypted at rest and come back masked, except through one audited reveal call. Platform configuration and secrets explains the model; this page is the code.
A value is addressed by application, section and property (orders / smtp /
password), plus an optional client (id or identifier). The global value and a client’s value
are separate: asking for a client’s value never falls back to the global one.
What your service account may do
Section titled “What your service account may do”The built-in application-service role holds config:view, config:update and config:reveal for
its own application, confined to the clients it is linked to (its own client list, else the
clients its application is enabled for) and the global value. Anything outside that is 403.
Read a plain value
Section titled “Read a plain value”v, err := c.PlatformConfig().Get(ctx, "orders", "smtp", "host", "" /* global */)host := v.ValueperClient, err := c.PlatformConfig().Get(ctx, "orders", "smtp", "host", "acme")var host = client.platformConfig().get("orders", "smtp", "host", null).getValue();var all = client.platformConfig().list("orders");const r = await client.platformConfig().get("orders", "smtp", "host", { clientId: "acme" });if (r.isOk()) console.log(r.value.value);$row = FlowCatalyst::platformConfig()->get('orders', 'smtp', 'host'); // global$row = FlowCatalyst::platformConfig()->get('orders', 'smtp', 'host', 'acme'); // a client's$rows = FlowCatalyst::platformConfig()->list('orders');let v = client.platform_config().get("orders", "smtp", "host", None).await?;println!("{}", v.value);A secret read this way returns the literal *** as its value, for every caller. That mask is not
a value.
Reveal a secret
Section titled “Reveal a secret”s, err := c.PlatformConfig().RevealSecret(ctx, "orders", "smtp", "password", "" /* or a client */)if err != nil { return err }dial(host, s.Value) // SecretResponse redacts Value in %v, %+v, %#v and slogvar secret = client.platformConfig().revealSecret("orders", "smtp", "password", null);connect(secret.value()); // RevealedSecret.toString() does not print the valueconst r = await client.platformConfig().revealSecret("orders", "smtp", "password");if (r.isOk()) connect(r.value.value); // non-enumerable: absent from console.log and JSON.stringify$secret = FlowCatalyst::platformConfig()->revealSecret('orders', 'smtp', 'password'); // 4th arg: clientconnect($secret->value); // var_dump, json_encode and toArray() show "***"let secret = client.platform_config().reveal_secret("orders", "smtp", "password", None).await?;connect(&secret.value);Every reveal is audited (who, which property, when, on whose behalf; never the value), and the
SDKs neither cache nor log it. The answer has Cache-Control: no-store and an updatedAt.
Caching. Revealing on every use writes an audit row each time. If you keep a secret in memory,
keep it briefly, keep it out of logs and error messages, and re-reveal when a use fails with an
authentication error (the secret may have been rotated) or when updatedAt changes.
A secret may also be a reference to AWS Secrets Manager or Parameter Store (aws-sm://...,
aws-ps://...) when the platform allows it; the reveal returns the secret it points at, resolved by
the platform. Your code does not change.
Write a value
Section titled “Write a value”set(app, section, property, value, valueType PLAIN|SECRET, client?) delete(app, section, property, client?)- Go:
c.PlatformConfig().Set(ctx, "orders", "smtp", "host", &client.SetConfigPropertyRequest{Value: "smtp.example.com"}) - Java:
client.platformConfig().set("orders", "smtp", "host", request) - TypeScript:
client.platformConfig().set("orders", "smtp", "password", { value, valueType: "SECRET" }) - PHP:
FlowCatalyst::platformConfig()->set('orders', 'smtp', 'host', 'smtp.example.com')(plain by default);delete(...)is idempotent.
Writing *** or an empty value to a secret is refused (400 SECRET_VALUE_MASKED,
SECRET_VALUE_REQUIRED): to keep a secret unchanged, do not set it.
Acting for a signed-in user
Section titled “Acting for a signed-in user”When your application changes or reveals configuration because one of its users asked (a settings
page in your application, say), pass who: it is sent as X-On-Behalf-Of and recorded in the audit
row beside your service account. At most 256 printable characters (400 INVALID_ON_BEHALF_OF); the
platform honours it only from service accounts.
ctx = client.WithOnBehalfOf(ctx, user.Email)s, err := c.PlatformConfig().RevealSecret(ctx, "orders", "smtp", "password", "")client.platformConfig().revealSecret("orders", "smtp", "password", null, user.email());await client.platformConfig().revealSecret("orders", "smtp", "password", undefined, { onBehalfOf: user.email });FlowCatalyst::platformConfig()->set('orders', 'mail', 'from', 'a@b.c', onBehalfOf: $user->email);client.platform_config().on_behalf_of(&user_email) .reveal_secret("orders", "smtp", "password", None).await?;It records who asked; it does not authorise them. Check the person’s permission in your application first.
Errors
Section titled “Errors”| Answer | Meaning |
|---|---|
403 |
Not your application, a client your account is not linked to, or no reveal permission |
404 |
No such property at that scope (remember: no fall-back from client to global) |
400 NOT_A_SECRET |
revealSecret on a plain property; use get |
400 SECRET_VALUE_MASKED / SECRET_VALUE_REQUIRED |
Writing the mask or an empty secret |
503 SECRET_REFERENCE_UNAVAILABLE, SECRET_REFERENCE_* |
An AWS reference could not be resolved |