Giter Site home page Giter Site logo

Comments (7)

tgross avatar tgross commented on May 19, 2024

Both forms can be supported at the same time:

I like where you're going with the overall concept here but I think supporting two different field names is inelegant. I'd love if we could do something like what the Docker folks did with the CMD and ENTRYPOINT Dockerfile stanzas, where they were able to parse both "/usr/bin/my/health" and ["/usr/bin/my/health", "--with", "some", "-args"].

The typical way to do this would be to deserialize the JSON into map[string][]json.RawMessage, parse the pieces we need, and then complete serialization of the nested ServiceConfig and BackendConfig structs (ref http://mattyjwilliams.blogspot.com/2013/01/using-go-to-unmarshal-json-lists-with.html, in the "option C" for an example of how this could be done). This means the code that parses the configuration will be less efficient but honestly we only parse it once so if it's mildly hairy that's fine as long as it's well-tested.

If we weren't going to do that, then I'd say we just break backwards compat (this is still marked alpha) and use a JSON array that will sometimes be a one-argument array. But if we can make the former work that'd be ideal.

from containerpilot.

tgross avatar tgross commented on May 19, 2024

I should probably point out that we'll probably need to do pre-processing via json.RawMessage to support #16 anyways, so it might be a good idea to get the scaffolding in place to support it sooner rather than later.

from containerpilot.

justenwalker avatar justenwalker commented on May 19, 2024

@tgross I agree. Originally I wanted to do something like you described (supporting both arrays and strings) but I wasn't sure how to. Thanks for the reference. I'll revisit this tonight and see if I come up with something.

from containerpilot.

justenwalker avatar justenwalker commented on May 19, 2024

@tgross I've implemented the enhancement as suggested. I'm not sure how you want to handle #16 though - since it kind of seems like the implementation strategy is still up in the air.

Also, it seemed like it would be good to support the string/array for interfaces as well - so if you only want to provide 1 interface, it doesn't need to be wrapped in an array.

from containerpilot.

tgross avatar tgross commented on May 19, 2024

I'm not sure how you want to handle #16 though - since it kind of seems like the implementation strategy is still up in the air.

Let's not worry about that for now; what you have here provides the places to hook-in for whomever is going to implement that nicely.

from containerpilot.

tgross avatar tgross commented on May 19, 2024

This has been merged and will be in the next release (presumably 0.0.5). Thanks @justenwalker!

from containerpilot.

tgross avatar tgross commented on May 19, 2024

Released in https://github.com/joyent/containerbuddy/releases/tag/0.0.5

from containerpilot.

Related Issues (20)

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.