~cytrogen/masto-fe

ref: 5ea3e8e765e0a0ae8e60c3e4e0b03cd3604ffdf1 masto-fe/db/seeds/04_admin.rb -rw-r--r-- 554 bytes
5ea3e8e7 — github-actions[bot] New Crowdin Translations (automated) (#27144) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true

if Rails.env.development?
  domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
  domain = domain.gsub(/:\d+$/, '')

  admin = Account.where(username: 'admin').first_or_initialize(username: 'admin')
  admin.save(validate: false)

  User.where(email: "admin@#{domain}").first_or_initialize(email: "admin@#{domain}", password: 'mastodonadmin', password_confirmation: 'mastodonadmin', confirmed_at: Time.now.utc, role: UserRole.find_by(name: 'Owner'), account: admin, agreement: true, approved: true).save!
end