diff --git a/app/models/gitea/base.rb b/app/models/gitea/base.rb index d14249bf..652fd777 100644 --- a/app/models/gitea/base.rb +++ b/app/models/gitea/base.rb @@ -1,4 +1,6 @@ -class Gitea::Base < Gitea::Database - self.abstract_class = true - +class Gitea::Base < ApplicationRecord + db_config = Rails.configuration.database_configuration[Rails.env]["gitea_server"] + raise 'gitea database config missing' if db_config.blank? + + establish_connection db_config end diff --git a/config/database.yml.example b/config/database.yml.example index 62b69492..b0f1f2be 100644 --- a/config/database.yml.example +++ b/config/database.yml.example @@ -17,20 +17,19 @@ default: &default username: root password: 123456 # socket: /var/run/mysqld/mysqld.sock + gitea_server: + aadapter: mysql2 + database: gitea_development + host: 127.0.0.1 + username: root + password: "123456" + encoding: utf8 development: <<: *default host: 127.0.0.1 database: forge_development -gitea_db: - adapter: mysql2 - database: gitea_development - host: 127.0.0.1 - username: root - password: "123456" - encoding: utf8 - # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production.