---
title: "Secrets & Feature Flags"
description: "Manage encrypted application secrets and runtime configuration centrally, alongside feature flags that control application behavior."
---

> Documentation Index
> Fetch the complete documentation index at: https://flarelens.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Secrets & Feature Flags

Manage encrypted application secrets and runtime configuration centrally, alongside feature flags that control application behavior—eliminating plaintext `.env` files on server disks and decoupling flag changes from container rebuilds.

## Edge AES-256-GCM Vault & Zero Disk Plaintext

Secrets are encrypted at the Cloudflare edge via the Web Crypto API using **AES-256-GCM** with unique random IVs before being stored in Workers KV, isolated per environment (`dev`, `uat`, `prod`) and service scope.

- **Zero `.env` Files on Host Disks**: During container creation, `flarelensd` receives decrypted secrets over authenticated TLS in memory and injects them directly into the Docker Engine API—nothing is ever written to persistent disks.
- **Declarative `env_vars` Separation**: Non-sensitive settings (log levels, public callback URLs, upstream aliases) live cleanly under `env_vars` in the service manifest and merge predictably with Vault secrets.

## Ephemeral RAM Secret Files (`/dev/shm`)

Workloads such as JWT/SAML signers, mTLS clients, CDC connectors, and database init scripts often require credentials mounted as files rather than environment variables. Prefix any Vault target path with `__FLARELENS_FILE__/container/path`:

```ini title="RAM-backed tmpfs secret file mappings"
GOOGLE_APPLICATION_CREDENTIALS=__FLARELENS_FILE__/run/secrets/gcp-sa.json
JWT_PRIVATE_KEY=__FLARELENS_FILE__/app/config/jwt-private.pem
TLS_CA_CERT=__FLARELENS_FILE__/etc/ssl/certs/internal-ca.crt
```

> **Permission isolation for root & non-root containers**
>
> `flarelensd` materializes secret files inside a `0700` RAM-backed `tmpfs` directory (`/dev/shm/flarelens-secrets/<slot>`) that vanishes on container stop or host power-off—setting strict `0600` permissions on private keys and `0644` on certificates, SQL init scripts, and YAML configs read by non-root container UIDs.

## Sub-Millisecond Feature Flags

Toggle kill-switches, percentage rollouts, and attribute targeting rules from the console without redeploying containers. Flag updates increment the monotonic `flags_version` counter piggybacked on the 15-second heartbeat—syncing deltas to hosts so applications evaluate flags locally in under a millisecond with zero per-request network latency.

Source: https://flarelens.dev/docs/secrets-and-flags/index.mdx
