-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
[Citi OFN Voucher] Add Activerecord encryption configuration and VINE api config #942
[Citi OFN Voucher] Add Activerecord encryption configuration and VINE api config #942
Conversation
Includes activerecord encryption configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AnsibleUndefinedVariable: 'active_record_encryption_primary_key' is undefined
TASK [app : template files] ****************************************************
failed: [local_test] (item={'src': 'env.j2', 'dest': '/home/openfoodnetwork/apps/openfoodnetwork/shared/config/.env.staging'}) => {"ansible_loop_var": "item", "changed": false, "item": {"dest": "/home/openfoodnetwork/apps/openfoodnetwork/shared/config/.env.staging", "src": "env.j2"}, "msg": "AnsibleUndefinedVariable: 'active_record_encryption_primary_key' is undefined"}
changed: [local_test] => (item={'src': 'postgresql.yml.j2', 'dest': '/home/openfoodnetwork/apps/openfoodnetwork/shared/config/database.yml'})
We probably need to add conditions for these variables, like others in this file.
I'd love to see a cleaner way to do it than what we currently have though. I can think of a couple of options. If we're happy to have these ENV vars defined but blank, we can:
- Set a default blank value for these variables in
all.yml
. Or - Use Jinja's default function, eg
{{ active_record_encryption_primary_key | default('') }}
(https://stackoverflow.com/a/35107741/421243)
Thanks for checking @dacook. I added condition so we don't end up with blank config item which might be problematic. I ended up adding VINE_API_URL config as well, which I had forgotten. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry one more question
There isn't any good reason to store it in secrets.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
{% if vine_api_url is defined %} | ||
VINE_API_URL="{{ vine_api_url }}" | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that a default would work instead?
{% if vine_api_url is defined %} | |
VINE_API_URL="{{ vine_api_url }}" | |
{% endif %} | |
VINE_API_URL="{{ vine_api_url | default('') }}" |
Just a question, not a real suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code handle a missing VINE_API_URL
with an error saying the VINE api isn't configured. With an empty string default it would result in a API connection error which could be confusing when the issue is actually a missing configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, the code would need to check for the presence of the variable instead.
Related to : openfoodfoundation/openfoodnetwork#12886
Update env template and secret example to include activerecord encryption configuration and VINE_API_URL config.