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

Allow numeric configuration values to be passed as strings #122

Closed
justenwalker opened this issue Mar 30, 2016 · 6 comments
Closed

Allow numeric configuration values to be passed as strings #122

justenwalker opened this issue Mar 30, 2016 · 6 comments

Comments

@justenwalker
Copy link
Contributor

Accept a string in place of a number for things like port and ttl - The change should be backwards compatible - it would accept both numbers and strings which contain a number.

Use Case

I have a process that I'm working on that generates a containerbuddy config file. It would be much more useful and maintainable to use the build-in serialization for JSON objects - I can put template definitions into strings, but it's impossible to do the same for numbers. A work around would be to concatenate strings together to form a JSON document instead of using a serializer - which is not ideal.

@tgross
Copy link
Contributor

tgross commented Mar 30, 2016

Sounds good to me.

@tgross
Copy link
Contributor

tgross commented Mar 31, 2016

I have a process that I'm working on that generates a containerbuddy config file. It would be much more useful and maintainable to use the build-in serialization for JSON objects

Just out of curiosity, what language/library is this? JSON serialization without support for numeric types is surprising (most of the stdlibs I've worked with have it).

@justenwalker
Copy link
Contributor Author

I'm using go. It has support for numbers - the problem is i need to generate a document that is not valid JSON - so I can't deserialize it using the normal method:

{
  "key": {{ .ENV_PORT }}
}

With this change I would be able to deserialize this instead:

{
  "key": "{{ .ENV_PORT }}"
}

@misterbisson
Copy link
Contributor

@justenwalker I see your use case, and now I'm curious about what's behind it ;-)

As @tgross said, this sounds good.

@tgross
Copy link
Contributor

tgross commented May 2, 2016

Was covered in #138

@tgross
Copy link
Contributor

tgross commented May 9, 2016

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

No branches or pull requests

3 participants