Skip to content

Config Management

Most customers manage configs through the Console UI. The management API is for infrastructure-as-code, CI/CD pipelines, setup scripts, and automated testing. Management operations are stateless HTTP calls — no WebSocket or connect() needed.

Update the Common Config

Every organization has a built-in "common" config at the root of the inheritance hierarchy. Fetch it, mutate it, save it.

python
async with AsyncSmplClient(environment="production", service="my-service") as client:
    common = await client.config.management.get("common")
    common.items = {
        "app_name": {"value": "Acme SaaS Platform", "type": "STRING"},
        "support_email": {"value": "support@acme.dev", "type": "STRING"},
        "max_retries": {"value": 3, "type": "NUMBER"},
        "request_timeout_ms": {"value": 5000, "type": "NUMBER"},
    }
    common.description = "Organization-wide shared configuration"
    await common.save()

Environment Overrides

Each config can have per-environment value overrides. Mutate the environments dict/map, then save.

python
common.environments = {
    "production": {
        "values": {
            "max_retries": {"value": 5},
            "request_timeout_ms": {"value": 10000},
        },
    },
    "staging": {
        "values": {
            "max_retries": {"value": 2},
        },
    },
}
await common.save()

Create a Config

Create a new config using the factory method. Set items and environment overrides, then call save() to persist.

python
user_service = client.config.management.new(
    "user_service",
    name="User Service",
    description="Configuration for the user microservice.",
)
user_service.items = {
    "database.host": {"value": "localhost", "type": "STRING"},
    "database.port": {"value": 5432, "type": "NUMBER"},
    "database.pool_size": {"value": 5, "type": "NUMBER"},
    "cache_ttl_seconds": {"value": 300, "type": "NUMBER"},
    "enable_signup": {"value": True, "type": "BOOLEAN"},
}
user_service.environments = {
    "production": {
        "values": {
            "database.host": {"value": "prod-users-rds.internal.acme.dev"},
            "database.pool_size": {"value": 20},
            "cache_ttl_seconds": {"value": 600},
        },
    },
}
await user_service.save()

Parent-Child Configs

Configs can have a parent, forming an inheritance hierarchy. Child configs inherit items from their parent. Values defined in the child take precedence over the parent.

python
auth_module = client.config.management.new(
    "auth_module",
    name="Auth Module",
    description="Authentication module within the user service.",
)
auth_module.items = {
    "session_ttl_minutes": {"value": 60, "type": "NUMBER"},
    "mfa_enabled": {"value": False, "type": "BOOLEAN"},
}
auth_module.environments = {
    "production": {
        "values": {
            "session_ttl_minutes": {"value": 30},
            "mfa_enabled": {"value": True},
        },
    },
}
await auth_module.save()

List and Get Configs

Retrieve all configs or fetch a specific one by key.

python
configs = await client.config.management.list()
for cfg in configs:
    print(f"{cfg.key} (parent: {cfg.parent})")

fetched = await client.config.management.get("user_service")
print(f"key={fetched.key}, name={fetched.name}")

Update a Config

Fetch a config, mutate its properties, and save. All mutations are local until save() is called.

python
user_service.description = "User microservice — updated description"
user_service.environments["production"]["values"]["cache_ttl_seconds"] = {"value": 900}
await user_service.save()

Delete a Config

Delete a config by key. Children must be deleted before their parents.

python
await client.config.management.delete("auth_module")
await client.config.management.delete("user_service")

Sync Client (Python)

For synchronous applications (Django, Flask, CLI tools), use SmplClient instead of AsyncSmplClient. The API is identical but without await.

python
from smplkit import SmplClient

with SmplClient(environment="production", service="my-service") as client:
    common = client.config.management.get("common")
    common.items["key"] = {"value": "val", "type": "STRING"}
    common.save()

    svc = client.config.management.new("my_svc", name="My Service")
    svc.items = {"db.host": {"value": "localhost", "type": "STRING"}}
    svc.save()

    configs = client.config.management.list()
    client.config.management.delete("my_svc")

Next Steps