Code Monkey home page Code Monkey logo

configloader-go's People

Contributors

adam-p avatar

Stargazers

 avatar

Watchers

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

configloader-go's Issues

Re-consider type checking

There might be no good reason to have type checking over and above what the codec unmarshaler provides. In theory it would be good if an unmarshaler didn't provide sufficient type checking (and just silently filled in zero values, say), but we haven't yet found an example where our type checking catches something that gets passed encoding/json or BurntSushi/toml. And it's quite a lot of additional complexity (and bug potential -- like catching conflicts that aren't really conflicts).

If removed, it would affect these things:

  • Remove the type checking (obvs).
  • Remove the "expected type" from the "conf" struct tag.
  • Re-consider TextUnmarshaler detection and handling. Probably we should:
    • Add a method to the Codec interface like SupportsTextUnmarshaler() bool. Use that to prevent recursion into the struct (like, into the fields of time.Time or whatever). (Maybe get even fancier and pass in reflect info and let the method do interface satisfaction checking. This might also give us BinaryUnmarshaler support.)
    • Don't "expect" a string type if a TextUnmarshaler field is found. Just don't recurse.
  • Probably FieldStruct.ExpectedType should be removed completely.

Can't set default or env override for value in map in struct

For example, for a config like:

type Config struct {
  M map[string]int
}

An environment override like:

[]configloader.EnvOverride{
  {
    EnvVar: "MYVAR",
    Key: configloader.Key{"M", "a"},
  },
}

...Will result in an error about M.a not being found in the struct.

The code should detect that M is a map and relax the consistency check.

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.