Skip to content
New issue

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

Adding support for sections defined as a map[string]string #10

Closed
wants to merge 1 commit into from

Conversation

peterebden
Copy link

Hi,

This is a patch we've been using for a while which allows sections to be a simple map[string]string. We've found it useful for cases where we want to have a section with a user-definable set of keys.

I'm not sure if this is something you'd like to see in gcfg or not? It's more permissive than the current model which might not be the direction you want to take it. Alternatively there might be another way to achieve the same effect which I'm not aware of.

Thanks!

@speter
Copy link
Contributor

speter commented Sep 11, 2016

Thanks for the feedback. Actually the goal (allowing user-supplied variable names) is the same as that for #9 so you're encouraged to provide feedback for that one.

Specifically for this PR, unfortunately I find multiple issues so I can't include it. The biggest one is that gcfg variables are case-insensitive, whereas your approach promotes case-sensitive processing. In addition, handling of subsections is problematic as well, you can't tell the difference between a subsection "one two" with variable "three" and a subsection "one" with variable "two three".

In order for this to be accepted, you would need to rework it so that the default variable name matching mechanism is case-insensitive (map[string] is case sensitive so it's not suitable) and that subsections are properly supported.

@speter
Copy link
Contributor

speter commented Sep 11, 2016

I missed one point; in addition to case-insensitive matching and proper subsection support, another thing that this PR is missing is support for non-string value types (including user-defined types), that is support for map[string]Anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants