https://github.com/openware/ika
Tiny configuration management for go
https://github.com/openware/ika
Last synced: 11 months ago
JSON representation
Tiny configuration management for go
- Host: GitHub
- URL: https://github.com/openware/ika
- Owner: openware
- License: mit
- Created: 2023-09-25T09:34:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-25T10:11:12.000Z (over 2 years ago)
- Last Synced: 2025-04-05T22:07:03.810Z (11 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ika: light config for go apps
## Introduction
Openware config for golang supporting json, yaml and ENV configs 12factor compliant
## Usage
`go get github.com/openware/pkg/ika`
### Example config and usage
```go
type YourAppConfig struct {
Number int64 `yaml:"number" env:"TEST_NUMBER" env-default:"1"`
String string `yaml:"string" env:"TEST_STRING" env-default:"default"`
NoDefault string `yaml:"no-default" env:"TEST_NO_DEFAULT"`
NoEnv string `yaml:"no-env" env-default:"default"`
Required string `yaml:"required" env-required:"true"`
}
func LoadYourAppConfig(cfgFilePath string) (*YourAppConfig, error) {
cfg := &YourAppConfig{}
if err := ika.ReadConfig(cfgFilePath, cfg); err != nil {
return nil, err
}
return cfg, nil
}
```
### Credits
Forked from: https://github.com/ilyakaznacheev/cleanenv