Comments (7)
Would you be able to submit a patch?
Although there may be code that rely on the current behavior that would get broken by such a change.
Is your current workaround to copy the fields directly in the struct?
from conf.
My current workaround is just to live with a prefix. It's not a major issue right now and I don't plan on working on it anytime soon, but it's low hanging fruit for anyone who wants to take a shot.
from conf.
Cool.
I've been thinking about how to avoid those kinds of discrepancies. Currently we build an intermediary representation of the configuration in memory, which we then convert to the configuration struct type.
Instead of doing this we could serialize the configuration to JSON, then use the standard JSON decoder to load values into the configuration struct. This way there can be no behavior differences (this is the approach taken by packages like https://github.com/ghodss/yaml for example).
Food for thoughts!
from conf.
In order to avoid breaking compatibility, what do you guys think about using _
as the special tag to indicate that the embedded struct shouldn't be prefixed?
I'm thinking about taking a stab at this too (my particular use case is creating and embedding general Suppressor configuration to be shared between the Kafka and NSQ apps). Happy to brainstorm further because this would be a really cool feature.
from conf.
That sounds like a good idea to me 👍
from conf.
Doing it backward-compatible seems like a good first step, if you want to make it the default then we can tag a v1 release of the package, and introduce the change afterward.
from conf.
This was fixed in #23.
from conf.
Related Issues (11)
- string fields are not parsed when numbers are set in cmd line. HOT 2
- flags with string literal "null" get skipped HOT 2
- Env Vars get interpreted incorrectly for default source
- String configs that look like numbers can get corrupted on parse HOT 1
- Add Sensitive Flag for conf tags. HOT 1
- document `conf:"_"` for embedded structs
- configure next source based on parsed conf
- Special case the "version" string
- behavior with maps
- Personalize help output HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conf.