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

Alternative command line friendly syntax for string list #69

Closed
patriknw opened this issue May 7, 2013 · 13 comments · Fixed by #70
Closed

Alternative command line friendly syntax for string list #69

patriknw opened this issue May 7, 2013 · 13 comments · Fixed by #70

Comments

@patriknw
Copy link
Contributor

patriknw commented May 7, 2013

We have the need to override string lists from command line -D parameters. That is not possible at the moment.
Example: akka.cluster.seed-nodes=["akka.tcp://TestApp@host1:2552", "akka.tcp://TestApp@host2:2552"]

That gives error: ConfigException$WrongType: system properties: akka.cluster.seed-nodes has type STRING rather than LIST

Some kind of alternative syntax would be nice.

As discussed the following syntax would be ok:
-Dakka.cluster.seed-nodes.0=akka.tcp://TestApp@host1:2552 -Dakka.cluster.seed-nodes.1=akka.tcp://TestApp@host2:2552

@slandelle
Copy link

Sorry to jump in.
Wouldn't it be better to support comma separated values?
-Dakka.cluster.seed-nodes=akka.tcp://TestApp@host1:2552,akka.tcp://TestApp@host2:2552

@havocp
Copy link
Collaborator

havocp commented May 7, 2013

There are a few problems with having syntax within the string rather than having distinct strings:

  • there are usually 2-3 layers of quoting (shell, properties file, the syntax)
  • it's a syntax to document/learn/implement (how do you escape a comma?)
  • you would get syntax errors rather than type errors when there's an actual type error, which could be confusing

We could also just support a JSON array syntax, but it would have a similar issue.

@slandelle
Copy link

OK, got it, thanks!

@havocp
Copy link
Collaborator

havocp commented May 7, 2013

Thanks for the comment though, I am not sure we have the perfect solution here yet, this is just the idea we have so far.

@patriknw
Copy link
Contributor Author

Hi @havocp, have you thought any more about this? Is it possible to complete the remaining things and release a new minor version?

@havocp
Copy link
Collaborator

havocp commented May 17, 2013

I think the PR is ready, I could make a release on Monday.

@patriknw
Copy link
Contributor Author

great, thanks
then we can use it for akka 2.2-RC1

@havocp havocp closed this as completed in 338150f May 20, 2013
@havocp
Copy link
Collaborator

havocp commented May 20, 2013

1.0.1 should be available/working

@patriknw
Copy link
Contributor Author

Thanks

@nilsga
Copy link

nilsga commented Jun 16, 2014

Is this somehow possible with environment variables as well?

@havocp
Copy link
Collaborator

havocp commented Jun 16, 2014

The lib only uses env variables if they are explicitly pulled in by the .conf file as a ${} reference. The only way I know to do a list as env vars is something like:

 emails += ${?EMAIL_1}
 emails += ${?EMAIL_2}

@RichardBradley
Copy link

This feature doesn't appear to be documented anywhere except here and http://stackoverflow.com/questions/16202501/how-can-i-override-a-typesafe-config-list-value-on-the-command-line and https://github.com/typesafehub/config/blob/f6680a5dad51d992139d45a84fad734f1778bf50/NEWS.md#101-may-19-2013 -- have I missed something?

I think it would be nice to add something to the docs about this. I'll see if I have time to make a PR in the coming weeks.

@havocp
Copy link
Collaborator

havocp commented Sep 23, 2016

HOCON.md has a section about it but it's probably hard to recognize as relevant if you're looking for the answer to "how do I put a list on the command line." Something more FAQ-like in the README might be nice.

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 a pull request may close this issue.

5 participants