Coder Social home page Coder Social logo

go-toml-config's People

Contributors

bpo avatar fwang2002 avatar matrixik avatar tgulacsi avatar tysonmote avatar xboston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-toml-config's Issues

Arrays

Looking it's wrapper for flag you probably will not support arrays?

Best regards,
Dobrosław Żybort

...is not a valid config setting

Hi,

i have the following config file myconf.conf:

[facebook]
appId = "somenumbers"
appSecret = "aString"

When I call
err := config.Parse("../conf/myconf.conf")
I get the error
facebook.appId is not a valid config setting.
Why? :(

Thanks!

Parse many config files

I like from Python ConfigParser option to load many config files:

from ConfigParser import SafeConfigParser

parser = SafeConfigParser()

parser.read(['does_not_exist.ini', 'config.ini', 'config_dev.ini', ])

print 'Log level:', parser.get('logging', 'log_level')
print 'Prefix:', parser.get('logging', 'prefix')

if 'config.ini:

[logging]
log_level = info
prefix = 'my_prefix'

and config_dev.ini:

[logging]
log_level = debug

Output would be:

Log level: debug
Prefix: "my_prefix"

ConfigParser overwrites the keys with each successive file, the order in which the files are read is determined by the order of the file names in the list passed to ConfigParser.read

Docs: http://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.read

Would be nice if you could add something similar.

Best regards,
Dobrosław Żybort

Inconsistent results with config.XVar

I am using the following setup...

main.go

package main

import (
    "fmt"
    "github.com/stvp/go-toml-config"
)

var (
    country          string
    atlantaEnabled   bool
    alantaPopulation int
)

func main() {
    config.StringVar(&country, "country", "Unknown")
    config.BoolVar(&atlantaEnabled, "atlanta.enabled", false)
    config.IntVar(&alantaPopulation, "atlanta.population", 0)
    config.Parse("./test.conf")
    fmt.Printf("Country: %v\n", country)
    fmt.Printf("AtlantaEnabled: %v\n", atlantaEnabled)
    fmt.Printf("AlantaPopulation: %v\n", alantaPopulation)
}

test.conf

country = "USA"

[atlanta]
enabled = true
population = 432427
temperature = 99.6

Sometimes I get the configured values:

Country: USA
AtlantaEnabled: true
AlantaPopulation: 432427

And other times I get the default values:

Country: Unknown
AtlantaEnabled: false
AlantaPopulation: 0

And other times I get a mix of both:

Country: Unknown
AtlantaEnabled: true
AlantaPopulation: 432427

Any help would be appreciated.

"foo is not a valid config setting"

hey, cool little lib. i used it for a few apps.
i have an ini file that's used by 2 different apps (a golang app and a shellscript).
so the ini file contains some settings that are not revelant to the golang app, which makes this lib complain about not being a valid config setting.

is there any solution for this?

DOCS are dead...

Like everyone I started to use this pkg but when I browse to the docs URL it says:

Documentation not displayed due to license restrictions.
See our license policy.

I think you should have a LICENSE file at the root of the repo in the order for it to work.

Disallow options with invalid names

From what I can tell, an option name like

"db-connections" is invalid in toml, it has to be "db_connections". However the library does not reject such names. When parsing the error is simply that it is an invalid toml file, so it's hard to determine what is going wrong.

The library functions should probably panic if the option name is not valid.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.