Skip to content

Commit 206b2ff

Browse files
committed
public release
0 parents  commit 206b2ff

File tree

103 files changed

+8095
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+8095
-0
lines changed

.gitignore

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
*.exe
2+
*.exe~
3+
*.dll
4+
*.so
5+
*.dylib
6+
*.test
7+
*.out
8+
coverage.*
9+
*.coverprofile
10+
profile.cov
11+
go.work
12+
go.work.sum
13+
.env
14+
.vscode/*
15+
!.vscode/settings.json
16+
!.vscode/tasks.json
17+
!.vscode/launch.json
18+
!.vscode/extensions.json
19+
!.vscode/*.code-snippets
20+
.history/
21+
*.vsix
22+
.idea/*
23+
.idea/**/workspace.xml
24+
.idea/**/tasks.xml
25+
.idea/**/usage.statistics.xml
26+
.idea/**/dictionaries
27+
.idea/**/shelf
28+
.idea/**/aws.xml
29+
.idea/**/contentModel.xml
30+
.idea/**/dataSources/
31+
.idea/**/dataSources.ids
32+
.idea/**/dataSources.local.xml
33+
.idea/**/sqlDataSources.xml
34+
.idea/**/dynamic.xml
35+
.idea/**/uiDesigner.xml
36+
.idea/**/dbnavigator.xml
37+
.idea/**/gradle.xml
38+
.idea/**/libraries
39+
cmake-build-*/
40+
.idea/**/mongoSettings.xml
41+
*.iws
42+
out/
43+
.idea_modules/
44+
atlassian-ide-plugin.xml
45+
.idea/replstate.xml
46+
.idea/sonarlint/
47+
com_crashlytics_export_strings.xml
48+
crashlytics.properties
49+
crashlytics-build.properties
50+
fabric.properties
51+
.idea/httpRequests
52+
.idea/caches/build_file_checksums.ser
53+
logs
54+
*.log
55+
npm-debug.log*
56+
yarn-debug.log*
57+
yarn-error.log*
58+
lerna-debug.log*
59+
.pnpm-debug.log*
60+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
61+
pids
62+
*.pid
63+
*.seed
64+
*.pid.lock
65+
lib-cov
66+
coverage
67+
*.lcov
68+
.nyc_output
69+
.grunt
70+
bower_components
71+
.lock-wscript
72+
build/Release
73+
node_modules/
74+
jspm_packages/
75+
web_modules/
76+
*.tsbuildinfo
77+
.npm
78+
.eslintcache
79+
.stylelintcache
80+
.rpt2_cache/
81+
.rts2_cache_cjs/
82+
.rts2_cache_es/
83+
.rts2_cache_umd/
84+
.node_repl_history
85+
*.tgz
86+
.yarn-integrity
87+
.env.development.local
88+
.env.test.local
89+
.env.production.local
90+
.env.local
91+
.cache
92+
.parcel-cache
93+
.next
94+
out
95+
.nuxt
96+
dist
97+
.cache/
98+
docs_markdown/.vitepress/cache
99+
.temp
100+
.docusaurus
101+
.serverless/
102+
.fusebox/
103+
.dynamodb/
104+
.tern-port
105+
.vscode-test
106+
.yarn/cache
107+
.yarn/unplugged
108+
.yarn/build-state.yml
109+
.yarn/install-state.gz
110+
.pnp.*
111+
test-configs/*
112+
builds

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 ebogdum
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Konfigo: Versatile Configuration Management
2+
3+
[![Go Report Card](https://goreportcard.com/badge/github.com/ebogdum/konfigo)](https://goreportcard.com/report/github.com/ebogdum/konfigo)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
6+
Konfigo is a powerful command-line tool designed to streamline your configuration workflow. It excels at reading various configuration file formats (JSON, YAML, TOML, .env), merging them intelligently, and processing the combined data against a user-defined schema for validation, transformation, variable substitution, and even batch output generation.
7+
8+
Whether you're managing simple settings or complex, multi-layered configurations with environment-specific overrides, Konfigo provides the tools to do so efficiently and reliably.
9+
10+
## Key Features
11+
12+
* **Multi-Format Support**: Reads and writes JSON, YAML, TOML, and .env files.
13+
* **Flexible Merging**: Intelligently merges multiple configuration sources, respecting order and immutability rules.
14+
* **Powerful Schema Processing**:
15+
* **Variable Substitution**: Inject dynamic values from environment variables (`KONFIGO_VAR_...`), dedicated variable files (`-V`), or schema defaults.
16+
* **Data Generation**: Create new configuration values (e.g., `concat` strings).
17+
* **Data Transformation**: Modify keys and values (e.g., `renameKey`, `changeCase`, `addKeyPrefix`, `setValue`).
18+
* **Data Validation**: Enforce rules (`required`, `type`, `min`, `max`, `minLength`, `enum`, `regex`).
19+
* **Input/Output Schemas**: Validate incoming data and filter outgoing data against defined structures.
20+
* **Batch Processing**: Use the `konfigo_forEach` directive in a variables file to generate multiple tailored configuration outputs from a single schema and run.
21+
* **Environment Variable Integration**:
22+
* Override any configuration value directly using `KONFIGO_KEY_path.to.key=value`.
23+
* **Comprehensive CLI**: Rich set of command-line options for fine-grained control over input, output, and processing behavior.
24+
25+
## Getting Started
26+
27+
### 1. Installation
28+
29+
The primary way to install Konfigo is using `go install` (ensure you have Go installed and your `GOPATH/bin` or `GOBIN` is in your PATH):
30+
31+
```bash
32+
go install github.com/ebogdum/konfigo/cmd/konfigo@latest
33+
```
34+
35+
For other installation methods, please refer to the [Installation Guide](docs_markdown/installation.md) in our documentation.
36+
37+
### 2. Basic Usage
38+
39+
Merge two configuration files (`config.json` and `overrides.yml`) and output the result to `final.yml`:
40+
41+
```bash
42+
konfigo -s config.json,overrides.yml -of final.yml
43+
```
44+
45+
### 3. Using a Schema
46+
47+
Merge `config.json`, process it with `schema.yml`, use variables from `staging-vars.yml`, and output to `staging_config.json`:
48+
49+
```bash
50+
konfigo -s config.json -S schema.yml -V staging-vars.yml -of staging_config.json
51+
```
52+
53+
## Documentation
54+
55+
For detailed information on all features, CLI options, and schema capabilities, please visit our full documentation site:
56+
57+
**[Konfigo Documentation Site](docs_markdown/html/index.html)** (Link to your VitePress build output)
58+
59+
Alternatively, you can browse the Markdown files directly in the [`/docs`](docs_markdown) directory.
60+
61+
Key sections:
62+
* [User Guide](docs_markdown/guide/index.md)
63+
* [Schema Guide](docs_markdown/schema/index.md)
64+
65+
## Contributing
66+
67+
Contributions are welcome! Please refer to our (TODO: Add CONTRIBUTING.md) for guidelines.
68+
69+
## License
70+
71+
Konfigo is licensed under the [MIT License](./LICENSE).
72+

builds.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Define your application name and main package path
4+
APP_NAME="konfigo"
5+
PACKAGE_PATH="./cmd/konfigo" # Or "cmd/myapp/main.go" or "./cmd/myapp"
6+
7+
# Define your target platforms (OS/ARCH)
8+
PLATFORMS=(
9+
"linux/amd64"
10+
"linux/arm64"
11+
"windows/amd64"
12+
"darwin/amd64"
13+
"darwin/arm64"
14+
"freebsd/amd64"
15+
"freebsd/arm64"
16+
"openbsd/amd64"
17+
"openbsd/arm64"
18+
"netbsd/amd64"
19+
"netbsd/arm64"
20+
)
21+
22+
# Create a directory for the builds
23+
BUILD_DIR="builds"
24+
mkdir -p "$BUILD_DIR"
25+
26+
for platform in "${PLATFORMS[@]}"
27+
do
28+
# Split the platform string into OS and ARCH
29+
IFS='/' read -r GOOS GOARCH <<< "$platform"
30+
31+
# Define the output name
32+
OUTPUT_NAME="$BUILD_DIR/${APP_NAME}-${GOOS}-${GOARCH}"
33+
if [ "$GOOS" = "windows" ]; then
34+
OUTPUT_NAME+=".exe"
35+
fi
36+
37+
echo "Building for $GOOS/$GOARCH..."
38+
env GOOS="$GOOS" GOARCH="$GOARCH" go build -o "$OUTPUT_NAME" "$PACKAGE_PATH"
39+
if [ $? -ne 0 ]; then
40+
echo "An error occurred while building for $GOOS/$GOARCH."
41+
# Optionally exit on error: exit 1
42+
fi
43+
done
44+
45+
echo "All builds completed."

0 commit comments

Comments
 (0)