Skip to content

local.json5

Sometimes during development, it is useful to be able to override settings in the ioto.json5 configuration file for testing purposes.

The local.json5 configuration file serves this purpose and is blended with and overrides the ioto.json5 configuration file.

The local.json5 configuration file has the same properties as the ioto.json5 configuration file.

Profiles

The local.json5 configuration can use multiple property profiles that are selected at runtime. When Ioto is run, it executes with selected profile. This is typically prod for production and dev for development. However, you can create your own profiles for any desired execution configuration such as qa or test.

The Ioto profile is defined via the PROFILE environment variable or via the --profile command line option.

Configuration profiles are defined under the conditional.profile property in any configuration file. The relevant configuration properties are selected by the current Ioto profile.

For example:

conditional: {
    profile: {
        dev: {
            limits: {
                //  Override the default stack size
                stack: '64k',
            }
        },
        prod: {
            log: {
                //  Send trace to a specific output file
                path: 'ioto.log',
            }
        }
    }
}

Overriding the device.json5

A typical use-case for the local.json5 is to override the device.json5 and specify a test device ID and product. You can also specify a manager account and cloud ID to auto-claim the device.

{
    conditional: {
        profile: {
            dev: {
                device: {
                    id: 'P4CH123456',
                    product: '01HAVJGGHYG7FXXXXXXXXXXXXX',
                    name: 'Acme Router',
                    description: 'Acme Router for Home Office',
                    model: 'Office-Hub',
                    test: true,
                    account: '01HK6J56WN9XXXXXXXXXXXXXXX',
                    cloud: '01HJ7W4YBWXXXXXXXXXXXXXXXX',
                }
            }
        }
    }
}