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

jira_connect.rb « atlassian « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ebed08280a2fcbc963e6709565ee631382a75f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module Atlassian
  module JiraConnect
    class << self
      def app_name
        "GitLab for Jira (#{gitlab_host})"
      end

      def app_key
        # App key must be <= 64 characters.
        # See: https://developer.atlassian.com/cloud/jira/platform/connect-app-descriptor/#app-descriptor-structure

        "gitlab-jira-connect-#{gitlab_host}"[..63]
      end

      private

      def gitlab_host
        return host_from_settings if Gitlab::CurrentSettings.jira_connect_proxy_url?

        Gitlab.config.gitlab.host
      end

      def host_from_settings
        uri = URI(Gitlab::CurrentSettings.jira_connect_proxy_url)

        uri.hostname + uri.path
      end
    end
  end
end