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

Diplomatic fix #20

Merged
merged 3 commits into from
Feb 8, 2020
Merged

Diplomatic fix #20

merged 3 commits into from
Feb 8, 2020

Conversation

jeffreycwitt
Copy link
Collaborator

No description provided.

@jeffreycwitt jeffreycwitt merged commit a990ff9 into master Feb 8, 2020
@stenskjaer
Copy link
Owner

Very cool!

I think I would do the Redis endpoint in the following way. In the docker-compose file set the actual value in stead of imitating a boolean.

environment:
- REDIS_DOCKER=redis

And then when you set the endpoint in processor.py you could do this:

redis_endpoint = os.getenv("REDIS_DOCKER", "localhost")

os.getenv() takes two arguments, the environment variable and a default. In this way you don't have to hardcode these values anywhere.

By the way, the default feature is parallel to when you use get() on a dictionary (a hash table in Ruby, I believe). For example take this dict:

my_dict = { 'first': 1, 'second': 2 }

You can get the values like my_dict['first'] and my_dict['second'] but my_dict['third'] will raise a KeyError because the key isn't in the dictionary. If you use my_dict.get('third', 42) you will get 42 if the key isn't in the dictionary.

@jeffreycwitt
Copy link
Collaborator Author

Yes, that is a much better approach. I will fix now!

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 this pull request may close these issues.

None yet

2 participants