Skip to content

Commit

Permalink
Add default admin user mechanism (UCLALibrary#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
cachemeoutside authored Nov 30, 2023
1 parent c841bb4 commit 59f1a2f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions charts/prod-oralhistory-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ externalsecrets:
- secretKey: SOLR_ADMIN_PASSWORD
remoteRef:
key: /apps/prodrke01/oh-public/solr_admin_password
- secretKey: ADMIN_EMAIL
remoteRef:
key: /apps/prodrke01/oh-public/admin_email
- secretKey: ADMIN_PASSWORD
remoteRef:
key: /apps/prodrke01/oh-public/admin_password

# configure a registry token for access to your container registry, needs read permissions, create secret in Rancher, follow instructions:
# https://ranchermanager.docs.rancher.com/v2.5/how-to-guides/new-user-guides/kubernetes-resources-setup/kubernetes-and-docker-registries#creating-a-registry
Expand Down
6 changes: 6 additions & 0 deletions charts/stage-oralhistory-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ externalsecrets:
- secretKey: STAGING_HTTP_BASIC_USERNAME
remoteRef:
key: /apps/prodrke01/oh-public/staging_http_basic_username
- secretKey: ADMIN_EMAIL
remoteRef:
key: /apps/prodrke01/oh-public/stage/admin_email
- secretKey: ADMIN_PASSWORD
remoteRef:
key: /apps/prodrke01/oh-public/stage/admin_password

# configure a registry token for access to your container registry, needs read permissions, create secret in Rancher, follow instructions:
# https://ranchermanager.docs.rancher.com/v2.5/how-to-guides/new-user-guides/kubernetes-resources-setup/kubernetes-and-docker-registries#creating-a-registry
Expand Down
7 changes: 7 additions & 0 deletions charts/test-oralhistory-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ externalsecrets:
- secretKey: STAGING_HTTP_BASIC_USERNAME
remoteRef:
key: /apps/testrke01/oh-public/staging_http_basic_username
- secretKey: ADMIN_EMAIL
remoteRef:
key: /apps/testrke01/oh-public/admin_email
- secretKey: ADMIN_PASSWORD
remoteRef:
key: /apps/testrke01/oh-public/admin_password


# configure a registry token for access to your container registry, needs read permissions, create secret in Rancher, follow instructions:
# https://ranchermanager.docs.rancher.com/v2.5/how-to-guides/new-user-guides/kubernetes-resources-setup/kubernetes-and-docker-registries#creating-a-registry
Expand Down
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
# Set up a default admin user, if we are in a Development environment, otherwise, skip
if Rails.env.development? || Rails.env.test?
if Rails.env.development? || Rails.env.test? || Rails.env.production?
u = User.find_or_create_by(email: ENV['ADMIN_EMAIL'] || '[email protected]')
u.password = ENV['ADMIN_PASSWORD'] || 'password'
u.save
Expand Down

0 comments on commit 59f1a2f

Please sign in to comment.