Skip to content

Command Flags Reference

This page provides comprehensive documentation for all Konfigo command-line flags and options.

Command-Line Interface

Global Options

FlagLong FormDescriptionDefault
-h--helpShow help message-
-v--verboseEnable informational loggingfalse
-d--debugEnable debug loggingfalse
-c--case-sensitiveUse case-sensitive key matchingfalse
-r--recursiveRecursively search subdirectoriesfalse

Source Input Options

FlagLong FormDescriptionNotes
-s--sourcesComma-separated list of source files/directoriesRequired
-sj--source-jsonForce input parsing as JSONFor stdin or ambiguous files
-sy--source-yamlForce input parsing as YAMLFor stdin or ambiguous files
-st--source-tomlForce input parsing as TOMLFor stdin or ambiguous files
-se--source-envForce input parsing as ENVFor stdin or ambiguous files

Schema Processing Options

FlagLong FormDescriptionNotes
-S--schemaPath to schema fileEnables advanced processing
-V--vars-filePath to variables fileHigh-priority variable definitions

Output Format Options

FlagLong FormDescriptionNotes
-oj--output-jsonOutput in JSON format-
-oy--output-yamlOutput in YAML format-
-ot--output-tomlOutput in TOML format-
-oe--output-envOutput in ENV format-
-of--output-fileWrite output to fileExtension determines format

Environment Variables

Runtime Configuration Overrides

Variable PatternDescriptionExample
KONFIGO_KEY_*Override any configuration keyKONFIGO_KEY_app.port=8080
KONFIGO_VAR_*Define schema variablesKONFIGO_VAR_DATABASE_HOST=prod-db.com

Processing Control

VariableDescriptionDefault
KONFIGO_LOG_LEVELSet logging level (ERROR, WARN, INFO, DEBUG)ERROR
KONFIGO_CONFIG_PATHDefault search paths for config filesCurrent directory

Exit Codes

CodeMeaningDescription
0SuccessOperation completed successfully
1General ErrorInvalid arguments or processing error
2File ErrorSource file not found or unreadable
3Parse ErrorInvalid syntax in source or schema files
4Validation ErrorSchema validation failed
5Schema ErrorInvalid or malformed schema

File Format Support

Input Formats

FormatExtensionsParserNotes
JSON.json, .jsoncStandard JSON with comment supportJSONC comments supported
YAML.yaml, .ymlYAML 1.2 compliantFull spec support
TOML.tomlTOML v1.0.0Complete specification
ENV.env, .envrcKey=value pairsShell-style variables

Output Formats

All input formats are supported as output formats with automatic conversion between them.

Error Handling

Common Error Patterns

  • File not found: Check file paths and permissions
  • Parse errors: Validate syntax with format-specific tools
  • Schema errors: Verify schema structure and required fields
  • Validation failures: Check data types and constraints

Debug Information

Use -v or -d flags to get detailed information about:

  • File discovery and loading
  • Merge order and precedence
  • Schema processing steps
  • Variable substitution
  • Validation results

Performance Considerations

Large Configuration Files

  • Use streaming parsers for files >100MB
  • Consider splitting large schemas into modules
  • Batch processing for multiple environments

Memory Usage

  • Konfigo loads all source files into memory
  • Schema processing requires additional memory for transformations
  • Monitor usage with large variable files

Integration Patterns

CI/CD Integration

bash
# Typical pipeline usage
konfigo -s base.yaml,env/${ENVIRONMENT}.yaml -S schema.yaml -of config.json

Container Integration

dockerfile
# Multi-stage build pattern
FROM konfigo:latest as config-builder
COPY configs/ /configs/
RUN konfigo -s /configs/base.yaml,/configs/prod.yaml -of /tmp/final.json

FROM alpine:latest
COPY --from=config-builder /tmp/final.json /app/config.json

Library Integration

Konfigo is designed as a CLI tool but can be integrated into build processes, deployment scripts, and configuration management workflows.

Version Compatibility

Schema Version Support

  • apiVersion: v1 - Current stable version
  • apiVersion: konfigo/v1alpha1 - Legacy format (deprecated)

Breaking Changes

Major version updates may include breaking changes to:

  • Schema format and processing
  • Command-line flag syntax
  • Output format structure

See release notes for migration guides and compatibility information.