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 to pass Diplomat::Configuration object when using diplomat #159

Closed
kamaradclimber opened this issue Dec 15, 2017 · 0 comments
Closed

Comments

@kamaradclimber
Copy link
Contributor

kamaradclimber commented Dec 15, 2017

(Not a very good issue description, feel free to rename it)

Let's consider the following scenario:

  • a first piece of code defines a consul token using:
Diplomat.configure do |c|
  c.token = A
end
  • a second piece of code (different library or maybe chef cookbook) defines another consul token (B).

  • the first piece of code later calls diplomat assuming the token is A.

In this case, you might encounter an unauthorized error.

The issue is that Diplomat::Configuration is static. In an ideal world we should be able to do:

my_conf = Diplomat::Configuration.new.tap do |c|
  c.token = 'aaaaa'
end
Diplomat::Service.new(my_conf).get_all

What do you think?

Annih added a commit to criteo-forks/diplomat that referenced this issue Mar 3, 2018
In some cases you might want to have multiple ::Diplomat::RestClient at
the same time but with different configurations. Using a static config
forbid this kind of uses.

Possible use cases:
- Multiple clients with different Tokens
- Multiple clients pointing to different Consul cluster

This commit should fix WeAreFarmGeek#159
Annih added a commit to criteo-forks/diplomat that referenced this issue Mar 3, 2018
In some cases you might want to have multiple ::Diplomat::RestClient at
the same time but with different configurations. Using a static config
forbid this kind of uses.

Possible use cases:
- Multiple clients with different Tokens
- Multiple clients pointing to different Consul cluster

This commit should fix WeAreFarmGeek#159
Annih added a commit to criteo-forks/diplomat that referenced this issue Mar 3, 2018
In some cases you might want to have multiple ::Diplomat::RestClient at
the same time but with different configurations. Using a static config
forbid this kind of uses.

Possible use cases:
- Multiple clients with different Tokens
- Multiple clients pointing to different Consul cluster

This commit should fix WeAreFarmGeek#159
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

No branches or pull requests

1 participant