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

Seeds Rework #174 #175

Merged
merged 10 commits into from
Feb 1, 2022
Merged

Seeds Rework #174 #175

merged 10 commits into from
Feb 1, 2022

Conversation

nelsonic
Copy link
Member

In order to run the seeds on Fly.io #172 / #173 we needed to move the bulk of the code to /lib that's what this PR does.
I've tried to minimise the changes but had to update a few tests to keep it all 100%. See: #174

@nelsonic nelsonic added the in-progress An issue or pull request that is being worked on by the assigned person label Jan 30, 2022
@nelsonic nelsonic self-assigned this Jan 30, 2022
@nelsonic nelsonic temporarily deployed to dwylauth January 30, 2022 21:25 Inactive
@codecov
Copy link

codecov bot commented Jan 30, 2022

Codecov Report

Merging #175 (134f1a3) into main (6466f8b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #175   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        24    +1     
  Lines          539       572   +33     
=========================================
+ Hits           539       572   +33     
Impacted Files Coverage Δ
lib/auth/status.ex 100.00% <ø> (ø)
lib/auth_web/controllers/api_controller.ex 100.00% <ø> (ø)
lib/auth/init/init.ex 100.00% <100.00%> (ø)
lib/auth/people_roles.ex 100.00% <100.00%> (ø)
lib/auth/session.ex 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6466f8b...134f1a3. Read the comment docs.

@nelsonic nelsonic temporarily deployed to dwylauth January 30, 2022 21:46 Inactive
@@ -1,9 +1,15 @@
export [email protected]
export AUTH_API_KEY=2PzB7PPnpuLsbWmWtXpGyI+kfSQSQ1zUW2Atz/+8PdZuSEJzHgzGnJWV35nTKRwx/dwylauth.herokuapp.com
export EMAIL_APP_URL=https://dwylmail.herokuapp.com
export AUTH_URL=dwylauth.herokuapp.com
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add the AUTH_URL environment variable to avoid the circular dependency on auth_plug noted by @tadasajon in #170

@nelsonic nelsonic assigned SimonLab and unassigned nelsonic Jan 30, 2022
@nelsonic nelsonic added awaiting-review An issue or pull request that needs to be reviewed and removed in-progress An issue or pull request that is being worked on by the assigned person labels Jan 30, 2022
@nelsonic nelsonic requested a review from SimonLab January 30, 2022 21:50
@nelsonic
Copy link
Member Author

@SimonLab please take a look at this PR and LMK what you think. Feedback very much welcome!

@nelsonic nelsonic temporarily deployed to dwylauth January 31, 2022 11:01 Inactive
@nelsonic nelsonic temporarily deployed to dwylauth January 31, 2022 11:07 Inactive
# to setup the database:
#
# mix ecto.setup
defmodule Auth.Seeds do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bulk of this code moved to init.ex above. ⬆️

@nelsonic nelsonic mentioned this pull request Jan 31, 2022
9 tasks
@nelsonic nelsonic added the tech-debt A feature/requirement implemented in a sub-optimal way & must be re-written label Jan 31, 2022
@nelsonic nelsonic temporarily deployed to dwylauth January 31, 2022 12:15 Inactive
@nelsonic nelsonic temporarily deployed to dwylauth January 31, 2022 14:02 Inactive
def main do
Logger.info("Initialising the Auth Database ...")
# check required environment variables:
Envar.is_set_all?(~w/ADMIN_EMAIL AUTH_URL ENCRYPTION_KEYS SECRET_KEY_BASE/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could create the list of environment variables as a module variable to make it easier to change later on if required. However I think it does the job at the moment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimonLab yeah, that would be a great future enhancement. 👍

lib/auth/init/init.ex Outdated Show resolved Hide resolved
Copy link
Member

@SimonLab SimonLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I've just added a couple of comments, let me know what you think @nelsonic but happy to merge otherwise

@nelsonic nelsonic temporarily deployed to dwylauth January 31, 2022 20:33 Inactive
@nelsonic
Copy link
Member Author

@SimonLab thanks very much for reviewing. I've applied your suggested change to init.ex
Please Merge if/when you're happy. Thanks. 👍

@SimonLab SimonLab merged commit ead7450 into main Feb 1, 2022
@SimonLab SimonLab deleted the seeds-rework-#174 branch February 1, 2022 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review An issue or pull request that needs to be reviewed tech-debt A feature/requirement implemented in a sub-optimal way & must be re-written
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants