Aller au contenu principal

Configure your application

Lordbase supplies database connection details. Your application owns its runtime configuration, migrations and secret handling.

Suggested environment variables​

These names are conventions used by these examples, not variables that configure the hosted service.

# Choose only the engine your application uses.
DATABASE_URL='postgresql://APPLICATION_USER:ENCODED_PASSWORD@YOUR_DATABASE_HOST:YOUR_PORT/YOUR_DATABASE_NAME'
REDIS_URL='rediss://APPLICATION_USER:ENCODED_PASSWORD@YOUR_DATABASE_HOST:YOUR_PORT/0'
LORDBASE_REDIS_KEY_PREFIX='YOUR_RETURNED_PREFIX:'
MONGODB_URI='mongodb://APPLICATION_USER:ENCODED_PASSWORD@YOUR_DATABASE_HOST:YOUR_PORT/YOUR_DATABASE_NAME?authSource=YOUR_DATABASE_NAME&tls=true'
MONGODB_DATABASE='YOUR_DATABASE_NAME'

These are templates, not working URLs. Replace every placeholder and preserve the TLS mode/options supplied for your deployment. The rediss and tls=true examples assume TLS is available. If it is not advertised, resolve transport security before sending production data.

Store real values in a local environment file excluded from Git, or inject them from a secret store. Load them using your runtime’s environment loader; naming a file .env does not automatically load it in every language. The engine examples below explicitly read process environment variables.

Application configuration​

Save only the values your application needs in its local configuration. If you use .env, load it with your framework or runtime’s environment loader. Add .env and .venv/ to the example project’s .gitignore.

The HTTP API examples are independent curl commands: replace the placeholders directly, with no environment file or shell setup. Native database drivers use your application’s configuration mechanism. Production applications can receive their settings through the hosting platform.

Configuration rules​

  • Use the public host/port from connection details, including when constructing a URI for a separately created application user.
  • URI-encode username/password components; characters such as @, :, /, ?, # and % must not be interpreted as URL syntax. Driver parameter objects can avoid this ambiguity.
  • Preserve MongoDB authSource and any TLS options. Preserve Redis database 0 and its separate key prefix.
  • Select a small pool size that fits the database limit across all application replicas, workers and migration processes.
  • Set connection and operation timeouts. Retry transient reads with bounded backoff. Reconcile the outcome of writes before retrying them.
  • Log the operation, sanitized destination, error class and request identifier where available; never log passwords, tokens or full connection strings.

Use separate development and production credentials. Rotating a password requires updating the application secret and reconnecting its pool; changing only dashboard metadata does not rotate a running application’s credentials.