{"content":"# aux4/config\n\nConfiguration utility for aux4. Manage YAML and JSON configuration files with get, set, and merge operations.\n\n## Installation\n\n``bash\naux4 aux4 pkger install aux4/config\n`\n\n## Usage\n\n### Create Configuration File\nIt can be a YAML or JSON file.\n\nconfig.yaml\n`yaml\nconfig:\n dev:\n host: localhost\n port: 3000\n prod:\n host: aux4.io\n port: 80\n`\n\nconfig.json\n`json\n{\n \"config\": {\n \"dev\": {\n \"host\": \"localhost\",\n \"port\": 3000\n },\n \"prod\": {\n \"host\": \"aux4.io\",\n \"port\": 80\n }\n }\n}\n`\n\n### Get configuration\n\nThe command [aux4 config get](./commands/config/get) can be used to get the configuration.\n\n`bash\n> aux4 config get dev\n`\n`json\n{\n \"host\": \"localhost\",\n \"port\": 3000\n}\n`\n\nOr specify a config file:\n\n`bash\n> aux4 config get --file config.yaml dev\n`\n`json\n{\n \"host\": \"localhost\",\n \"port\": 3000\n}\n`\n\n\n`bash\n> aux4 config get dev/host\n`\n`bash\nlocalhost\n`\n\nOr with a specific config file:\n\n`bash\n> aux4 config get --file config.yaml dev/host\n`\n`bash\nlocalhost\n`\n\n### Set configuration\n\nThe command [aux4 config set](./commands/config/set) can be used to set the configuration.\n\n`bash\n> aux4 config set --name dev/host --value dev.aux4.io\n`\n\nOr with a specific config file:\n\n`bash\n> aux4 config set --file config.yaml --name dev/host --value dev.aux4.io\n`\n\n`bash\n> aux4 config get dev\n`\n`json\n{\n \"host\": \"dev.aux4.io\",\n \"port\": 3000\n}\n`\n\n### Merge configuration\n\nThe command [aux4 config merge](./commands/config/merge) can be used to merge configurations.\n\n`bash\n> aux4 config get --file dev.yaml | aux4 config merge --file prod.yaml | jq .\n`\n`json\n{\n \"dev\": {\n \"host\": \"localhost\",\n \"port\": 3000\n },\n \"prod\": {\n \"host\": \"aux4.io\",\n \"port\": 80\n }\n}\n`\n\nYou can also save the merged result directly to a file:\n\n`bash\n> aux4 config get --file dev.yaml | aux4 config merge --file prod.yaml --save\n`\n\nOr merge into a specific path within the configuration:\n\ndb.json:\n`json\n{\n \"host\": \"localhost\",\n \"port\": 5432,\n \"user\": \"postgres\",\n \"password\": \"postgres\",\n \"database\": \"postgres\"\n}\n`\n\n`bash\n> cat db.json | aux4 config merge --file config.json --name dev/db | jq .\n`\n`json\n{\n \"dev\": {\n \"db\": {\n \"database\": \"postgres\",\n \"host\": \"localhost\",\n \"password\": \"postgres\",\n \"port\": 5432,\n \"user\": \"postgres\"\n },\n \"host\": \"localhost\",\n \"port\": 3000\n }\n}\n``\n"}