database_name = "scribe_#{Lucky::Env.name}" AppDatabase.configure do |settings| if Lucky::Env.production? settings.credentials = Avram::Credentials.parse(ENV["DATABASE_URL"]) else settings.credentials = Avram::Credentials.parse?(ENV["DATABASE_URL"]?) || Avram::Credentials.new( database: database_name, hostname: ENV["DB_HOST"]? || "localhost", port: ENV["DB_PORT"]?.try(&.to_i) || 5432, username: ENV["DB_USERNAME"]? || "postgres", password: ENV["DB_PASSWORD"]? || "postgres" ) end end Avram.configure do |settings| settings.database_to_migrate = AppDatabase settings.lazy_load_enabled = Lucky::Env.production? end