ADD ci database port

This commit is contained in:
Jasder 2020-08-17 14:29:09 +08:00
parent af220cfffc
commit a4d8338cb5
2 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,7 @@ class Ci::Drone::Server
"service docker start; docker rm -f `docker ps -qa`; docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DRONE_DATABASE_DRIVER=mysql \
-e DRONE_DATABASE_DATASOURCE=#{database_username}:#{database_password}@#{database_host}:3306/drone?parseTime=true \
-e DRONE_DATABASE_DATASOURCE=#{database_username}:#{database_password}@#{database_host}:#{database_port}/drone?parseTime=true \
-e DRONE_GITEA_SERVER=#{gitea_url} \
-e DRONE_GITEA_CLIENT_ID=#{client_id} \
-e DRONE_GITEA_CLIENT_SECRET=#{client_secret} \
@ -51,6 +51,10 @@ class Ci::Drone::Server
database_config[Rails.env]["ci"]["host"]
end
def database_port
database_config[Rails.env]["ci"]["port"] || 3306
end
def database
database_config[Rails.env]["ci"]["database"]
end

View File

@ -1,7 +1,6 @@
class Ci::CloudAccount < ApplicationRecord
belongs_to :project
belongs_to :user
belongs_to :repository, foreign_key: :repo_id
def drone_host
[drone_ip, ":80"].join