forked from Gitlink/forgeplus
Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
0468c8df53 | |
|
|
6be30ba278 |
|
|
@ -1,6 +1,6 @@
|
|||
class Ci::PipelinesController < Ci::BaseController
|
||||
|
||||
before_action :require_login, only: %i[list create content]
|
||||
before_action :require_login, only: %i[list create content ssh_server]
|
||||
skip_before_action :connect_to_ci_db, except: %i[list create destroy content]
|
||||
before_action :load_project, only: %i[create content]
|
||||
before_action :load_repo, only: %i[create content]
|
||||
|
|
@ -291,4 +291,8 @@ class Ci::PipelinesController < Ci::BaseController
|
|||
rescue Exception => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def ssh_server
|
||||
render json: Ci::SSHServer.config
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
module Ci::SSHServer
|
||||
class << self
|
||||
def config
|
||||
gitea_config = {}
|
||||
|
||||
begin
|
||||
config = Rails.application.config_for(:configuration).symbolize_keys!
|
||||
ci_ssh_server = config[:ci_ssh_server].symbolize_keys!
|
||||
raise 'gitea config missing' if ci_ssh_server.blank?
|
||||
rescue => ex
|
||||
raise ex if Rails.env.production?
|
||||
|
||||
puts %Q{\033[33m [warning] ci_ssh_server config or configuration.yml missing,
|
||||
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
|
||||
ci_ssh_server = {}
|
||||
end
|
||||
ci_ssh_server
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -44,6 +44,7 @@ Rails.application.routes.draw do
|
|||
resources :pipelines do
|
||||
collection do
|
||||
get :list
|
||||
get :ssh_server
|
||||
end
|
||||
member do
|
||||
get :content
|
||||
|
|
|
|||
Loading…
Reference in New Issue