Skip to content

Configuration Skill

JSON5 configuration management: profiles, service flags, directory layout, logging, and build-time blending.

Invoke with: /config

Configuration Files

Configuration files live in state/config/ in the app directory:

FilePurpose
ioto.json5Main config: profile, services, database, TLS, logging, MQTT, update
web.json5Web server: endpoints, routes, auth roles, sessions, limits
schema.json5Database schema: models, field types, validation, TTL
device.json5Device identity: name, model, serial number
local.json5Local overrides (not committed to git)

Core ioto.json5 Structure

json5
{
    version: '1.0.0',
    profile: 'dev',
    app: 'http',

    conditional: {
        profile: {
            dev: {
                directories: {
                    certs: '../../certs',
                    log: '.',
                    state: 'state',
                },
                optimize: 'debug',
                log: {
                    path: 'stdout',
                    format: '%S: %M',
                    types: 'error,info',
                    sources: 'all,!mbedtls',
                },
            },
            prod: {
                directories: {
                    log: '/var/log',
                    state: '/var/lib/ioto',
                },
                optimize: 'release',
            },
        },
    },

    services: {
        ai: false,
        database: true,
        mqtt: false,
        url: true,
        web: true,
    },

    database: {
        path: '@db/device.db',
        schema: '@config/schema.json5',
    },

    tls: {
        authority: '@certs/roots.crt',
        certificate: '@certs/test.crt',
        key: '@certs/test.key',
    },

    log: {
        path: 'stdout',
        format: '%D %H %A[%P] (%T, %S): %M',
        types: 'error,info',
        sources: 'all,!mbedtls',
    },
}

Profiles

The conditional.profile section defines per-profile overrides:

  • dev — Debug builds, local directories, stdout logging
  • prod — Release builds, system directories (/var/log, /var/lib/ioto), file logging

Services

ServiceDescription
aiOpenAI integration
databaseEmbedded database
mqttMQTT client
webHTTP/HTTPS web server
urlHTTP client
updateOTA firmware updates
provisionCloud device provisioning
syncDatabase cloud synchronization

Path Expansion

Paths prefixed with @ are expanded relative to the state directory:

PrefixExpands ToExample
@config/state/config/@config/schema.json5
@db/state/db/@db/device.db
@certs/state/certs/@certs/test.crt

Logging

json5
log: {
    path: 'stdout',
    format: '%D %H %A[%P] (%T, %S): %M',
    types: 'error,info',
    sources: 'all,!mbedtls',
}

Format tokens: %D date, %H time, %A app name, %P PID, %T type, %S source, %M message.

Accessing Config at Runtime

c
cchar *value = ioGetConfig("ai.model", "gpt-4o-mini");
bool enabled = jsonGetBool(ioto->config, 0, "ai.enable", 0);
Json *config = ioto->config;