diff --git a/content/Stores/ini-file.mdx b/content/Stores/ini-file.mdx new file mode 100644 index 0000000..9927e71 --- /dev/null +++ b/content/Stores/ini-file.mdx @@ -0,0 +1,142 @@ +--- +id: ini-file +slug: ini-file +title: INI File +--- + +Integrates the Configu Orchestrator with your INI files. + +## Limitations + + +- Configs belonging to the root set will always appear above all other section due to how INI files work. + + + +## SDK Usage + + + +```js +import path from 'path'; +import { + IniFileConfigStore, + ConfigSet, + ConfigSchema, + UpsertCommand, + EvalCommand, + ExportCommand, + TestCommand, + DeleteCommand, +} from '@configu/node'; + +(async () => { + try { + const store = new IniFileConfigStore({ path: 'store.ini' }); + const set = new ConfigSet('test'); + const schema = new ConfigSchema(path.join(__dirname, 'get-started.cfgu.json')); + + await new TestCommand({ store, clean: true }).run(); + + await new UpsertCommand({ + store, + set, + schema, + configs: { + GREETING: 'hey', + SUBJECT: 'configu node.js sdk', + }, + }).run(); + + const data = await new EvalCommand({ + store, + set, + schema, + }).run(); + + const configurationData = await new ExportCommand({ + data, + }).run(); + + console.log(configurationData); + + await new DeleteCommand({ store, set, schema }).run(); + } catch (error) { + console.error(error); + } +})(); +``` + +```python +coming soon +``` + + + +## CLI Usage + +Configu's CLI needs to be directed to your desired file by providing a file path via the [.configu file](../cli-config). + +example .configu file: + +```json +{ + "stores": { + "ini-file-store": { + "type": "ini-file", + "configuration": { + "path": "path/to/file.ini" + } + } + } +} +``` + +### Test command + +```bash +configu test --store "ini-file-store" --clean +``` + +### Upsert command + +```bash +configu upsert --store "ini-file-store" --set "test" --schema "./get-started.cfgu.json" \ + -c "GREETING=hey" \ + -c "SUBJECT=configu node.js sdk" +``` + +### Eval and export commands + +```bash +configu eval --store "ini-file-store" --set "test" --schema "./get-started.cfgu.json" \ + | configu export +``` + +Export result: + +```json +{ + "GREETING": "hey", + "SUBJECT": "configu node.js sdk", + "MESSAGE": "hey, configu node.js sdk!" +} +``` + +### Delete command + +Clean up the previous upsert by using: + +```bash +configu delete --store "ini-file-store" --set "test" --schema "./get-started.cfgu.json" +``` + +## Examples + +INI file store after upsert: + +```ini +[test] +GREETING=hey +SUBJECT=configu node.js sdk +``` diff --git a/content/sidebar.json b/content/sidebar.json index 61ed6c8..fe16514 100644 --- a/content/sidebar.json +++ b/content/sidebar.json @@ -159,6 +159,16 @@ } ] }, + { + "title": "Stores", + "isOpenByDefault": false, + "items": [ + { + "title": "INI file", + "slug": "ini-file" + } + ] + }, { "title": "IDE Plugins", "isOpenByDefault": false,