Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-24 18:11:30 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-25 17:16:41 +0300
commitb3cf1530829755411a7057031c2e8ea36ee31b62 (patch)
treec6e59cba4d4c5f9ed23dcae20dd773d60ef519b9 /app/models/clusters/applications/jupyter.rb
parent4220e914db356f4a55c771a7ad7f559e2507dd56 (diff)
Add oauth reference to jupyter cluster app
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/clusters/applications/jupyter.rb')
-rw-r--r--app/models/clusters/applications/jupyter.rb32
1 files changed, 29 insertions, 3 deletions
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb
index ef62be34abd..1f9cb1aade2 100644
--- a/app/models/clusters/applications/jupyter.rb
+++ b/app/models/clusters/applications/jupyter.rb
@@ -9,6 +9,8 @@ module Clusters
include ::Clusters::Concerns::ApplicationStatus
include ::Clusters::Concerns::ApplicationData
+ belongs_to :oauth_application, class_name: 'Doorkeeper::Application'
+
default_value_for :version, VERSION
def chart
@@ -32,16 +34,40 @@ module Clusters
)
end
+ def callback_url
+ "http://#{hostname}/hub/oauth_callback"
+ end
+
private
def specification
{
- "ingress" => { "hosts" => [hostname] },
- "hub" => { "cookieSecret" => SecureRandom.hex(32) },
- "proxy" => { "secretToken" => SecureRandom.hex(32) }
+ "ingress" => {
+ "hosts" => [hostname]
+ },
+ "hub" => {
+ "extraEnv" => {
+ "GITLAB_HOST" => gitlab_url
+ },
+ "cookieSecret" => SecureRandom.hex(32)
+ },
+ "proxy" => {
+ "secretToken" => SecureRandom.hex(32)
+ },
+ "auth" => {
+ "gitlab" => {
+ "clientId" => oauth_application.uid,
+ "clientSecret" => oauth_application.secret,
+ "callbackUrl" => callback_url
+ }
+ }
}
end
+ def gitlab_url
+ Gitlab.config.gitlab.url
+ end
+
def content_values
YAML.load_file(chart_values_file).deep_merge!(specification)
end