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:
| File | Purpose |
|---|---|
ioto.json5 | Main config: profile, services, database, TLS, logging, MQTT, update |
web.json5 | Web server: endpoints, routes, auth roles, sessions, limits |
schema.json5 | Database schema: models, field types, validation, TTL |
device.json5 | Device identity: name, model, serial number |
local.json5 | Local 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
| Service | Description |
|---|---|
ai | OpenAI integration |
database | Embedded database |
mqtt | MQTT client |
web | HTTP/HTTPS web server |
url | HTTP client |
update | OTA firmware updates |
provision | Cloud device provisioning |
sync | Database cloud synchronization |
Path Expansion
Paths prefixed with @ are expanded relative to the state directory:
| Prefix | Expands To | Example |
|---|---|---|
@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;