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

Environment vars not ideal for some environments #58

Closed
wetzler opened this issue Dec 3, 2014 · 2 comments
Closed

Environment vars not ideal for some environments #58

wetzler opened this issue Dec 3, 2014 · 2 comments

Comments

@wetzler
Copy link
Contributor

wetzler commented Dec 3, 2014

[This was shared by another developer; I'm sharing it here on their behalf]

I'm starting to use the keen.io ruby gem and I have feedback. On some hosting systems (like EngineYard), it is very complicated to configure libraries using environment variables. Instead, they recommend using a yaml file which is in a backed-up folder https://support.cloud.engineyard.com/entries/36999448-Environment-Variables-and-Why-You-Shouldn-t-Use-Them. I looked at the code (default_client specifically) and it looks like a "manual configuration" from an initializer would be a bit fragile. I would have to make sure I artificially set the env vars before bundler is loaded, so that the default client is not generated with empty credentials. That, or create my own instance of Keen::Client (which I'm probably going to do). Well - just a bit of feedback; in some case, using env vars is really not possible (which actually made me delay the use of keen.io several times already).

@joshed-io
Copy link
Contributor

Thanks for sharing. I would suggest manual configuration of the default client or a new client instance. Here are examples of both:

# load the configuration, wherever it may be
config = YAML.load("/path/to/config.yaml")

# configure default instance
Keen.project_id = config[:project_id]
Keen.write_key = config[:write_key]
Keen.read_key = config[:read_key]
Keen.master_key = config[:master_key]

# or configure new client instance
keen = Keen::Client.new(:project_id => config[:project_id],
                        :write_key  => config[:write_key],
                        :read_key   => config[:read_key],
                        :master_key => config[:master_key])

@thbar
Copy link

thbar commented Aug 27, 2015

@dzello thanks for the feedback - I'm revisiting this and this is going to be helpful.

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

No branches or pull requests

3 participants