Sha256: cb9726f748a2868cfa8dbcaa177d5805f37f9862c369a61dbb1c7fa81f623039

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

require 'sinatra/activerecord'
require 'sinatra/activerecord/rake'
require 'osso'

namespace :osso do
  desc 'Bootstrap Osso data for a deployment'
  task :bootstrap do
    %w[Production Staging Development].each do |environment|
      Osso::Models::OauthClient.create!(
        name: environment,
      ) unless Osso::Models::OauthClient.find_by_name(environment)
    end

    Osso::Models::AppConfig.create

    admin_email = ENV['ADMIN_EMAIL']

    if admin_email
      admin = Osso::Models::Account.create!(
        email: admin_email,
        status_id: 1,
        role: 'admin',
      )

      rodauth = Osso::Admin.rodauth.new(Osso::Admin.new({}))
      account = rodauth.account_from_login(admin_email)
      rodauth.setup_account_verification
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
osso-0.0.5 lib/tasks/bootstrap.rake