Don't require ADMIN_EMAIL

This commit is contained in:
Jamil Bou Kheir
2021-12-22 22:24:02 -06:00
parent db697cbfba
commit f6149fb281
2 changed files with 5 additions and 3 deletions

View File

@@ -58,7 +58,6 @@ jobs:
unit-test:
runs-on: ubuntu-18.04
env:
ADMIN_EMAIL: firezone@localhost
MIX_ENV: test
POSTGRES_HOST: localhost
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -14,7 +14,10 @@ defmodule FzHttp.Repo.Migrations.AddRoleToUsers do
# Make existing admin the admin if exists. Admin is most likely the first created user.
flush()
admin_email = System.fetch_env!("ADMIN_EMAIL")
execute "UPDATE users SET role = 'admin' WHERE email = '#{admin_email}'"
admin_email = System.get_env("ADMIN_EMAIL")
if admin_email do
execute "UPDATE users SET role = 'admin' WHERE email = '#{admin_email}'"
end
end
end