We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this is an awesome go package. But I have trouble when using the OS variable on my configuration data. I am using go 1.14.
I have db.json with some data below: {"name": "MyApp", "port": "${ APP_PORT }"}
db.json
{"name": "MyApp", "port": "${ APP_PORT }"}
From my go code v, err := c.Get("port") // just return ${ APP_PORT } for the v
v, err := c.Get("port") // just return ${ APP_PORT } for the v
so I get v with value ${ APP_PORT }, not the exact value of OS.Getenv("APP_PORT").
fmt.Println(v) // ${ APP_PORT }
The text was updated successfully, but these errors were encountered:
I tested your sample using Go v1.14 but it worked. Please see this attachment: Sample.zip
If you still sure it works that way please attach your code.
Sorry, something went wrong.
Nice, everything works perfectly. It doesn't work when using feeder.JsonDirectory{Path: "./config"}. I change the code a little bit from Sample.zip:
feeder.JsonDirectory{Path: "./config"}.
I make .env and a config folder to store all the configs from the root folder config
.env
config
|- main.go |- .env |- go.mod |- config |-- c.json
from .env APP_PORT=8080
func main() { c, err := config.New(config.Options{ Feeder: feeder.JsonDirectory{Path: "./config"}, Env: ".env", }) if err != nil { panic(err) } v, err := c.Get("c.port") fmt.Println(v, err) // it prints ${ APP_PORT } <nil> }
What am I missing?
This bug is fixed now. Thanks for your report. New release: https://github.com/golobby/config/releases/tag/v1.0.4
No branches or pull requests
this is an awesome go package. But I have trouble when using the OS variable on my configuration data. I am using go 1.14.
I have
db.json
with some data below:{"name": "MyApp", "port": "${ APP_PORT }"}
From my go code
v, err := c.Get("port") // just return ${ APP_PORT } for the v
so I get v with value ${ APP_PORT }, not the exact value of OS.Getenv("APP_PORT").
fmt.Println(v) // ${ APP_PORT }
The text was updated successfully, but these errors were encountered: