Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fe145c6f
Commit
fe145c6f
authored
Jun 14, 2021
by
Zhu Shuang
Committed by
Thong Kuah
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move COM_URL related variables to a module
parent
2eb9b6eb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
22 deletions
+46
-22
app/helpers/version_check_helper.rb
app/helpers/version_check_helper.rb
+1
-1
lib/bulk_imports/clients/graphql.rb
lib/bulk_imports/clients/graphql.rb
+1
-1
lib/gitlab.rb
lib/gitlab.rb
+4
-7
lib/gitlab/email/message/in_product_marketing/experience.rb
lib/gitlab/email/message/in_product_marketing/experience.rb
+1
-1
lib/gitlab/saas.rb
lib/gitlab/saas.rb
+26
-0
spec/lib/gitlab/tracking/standard_context_spec.rb
spec/lib/gitlab/tracking/standard_context_spec.rb
+3
-3
spec/lib/gitlab_spec.rb
spec/lib/gitlab_spec.rb
+10
-9
No files found.
app/helpers/version_check_helper.rb
View file @
fe145c6f
...
...
@@ -19,7 +19,7 @@ module VersionCheckHelper
end
def
source_host_url
Gitlab
::
COM_URL
Gitlab
::
Saas
.
com_url
end
def
source_code_group
...
...
lib/bulk_imports/clients/graphql.rb
View file @
fe145c6f
...
...
@@ -25,7 +25,7 @@ module BulkImports
delegate
:query
,
:parse
,
:execute
,
to: :client
def
initialize
(
url:
Gitlab
::
COM_URL
,
token:
nil
)
def
initialize
(
url:
Gitlab
::
Saas
.
com_url
,
token:
nil
)
@url
=
Gitlab
::
Utils
.
append_path
(
url
,
'/api/graphql'
)
@token
=
token
@client
=
Graphlient
::
Client
.
new
(
...
...
lib/gitlab.rb
View file @
fe145c6f
...
...
@@ -39,17 +39,14 @@ module Gitlab
end
end
COM_URL
=
'https://gitlab.com'
STAGING_COM_URL
=
'https://staging.gitlab.com'
APP_DIRS_PATTERN
=
%r{^/?(app|config|ee|lib|spec|
\(\w
*
\)
)}
.
freeze
SUBDOMAIN_REGEX
=
%r{
\A
https://[a-z0-9]+
\.
gitlab
\.
com
\z
}
.
freeze
VERSION
=
File
.
read
(
root
.
join
(
"VERSION"
)).
strip
.
freeze
INSTALLATION_TYPE
=
File
.
read
(
root
.
join
(
"INSTALLATION_TYPE"
)).
strip
.
freeze
HTTP_PROXY_ENV_VARS
=
%w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY)
.
freeze
def
self
.
com?
# Check `gl_subdomain?` as well to keep parity with gitlab.com
Gitlab
.
config
.
gitlab
.
url
==
COM_URL
||
gl_subdomain?
Gitlab
.
config
.
gitlab
.
url
==
Gitlab
::
Saas
.
com_url
||
gl_subdomain?
end
def
self
.
com
...
...
@@ -57,7 +54,7 @@ module Gitlab
end
def
self
.
staging?
Gitlab
.
config
.
gitlab
.
url
==
STAGING_COM_URL
Gitlab
.
config
.
gitlab
.
url
==
Gitlab
::
Saas
.
staging_com_url
end
def
self
.
canary?
...
...
@@ -73,11 +70,11 @@ module Gitlab
end
def
self
.
org?
Gitlab
.
config
.
gitlab
.
url
==
'https://dev.gitlab.org'
Gitlab
.
config
.
gitlab
.
url
==
Gitlab
::
Saas
.
dev_url
end
def
self
.
gl_subdomain?
SUBDOMAIN_REGEX
===
Gitlab
.
config
.
gitlab
.
url
Gitlab
::
Saas
.
subdomain_regex
===
Gitlab
.
config
.
gitlab
.
url
end
def
self
.
dev_env_org_or_com?
...
...
lib/gitlab/email/message/in_product_marketing/experience.rb
View file @
fe145c6f
...
...
@@ -43,7 +43,7 @@ module Gitlab
survey_id:
EASE_SCORE_SURVEY_ID
}
"
#{
Gitlab
::
COM_URL
}
/-/survey_responses?
#{
params
.
to_query
}
"
"
#{
Gitlab
::
Saas
.
com_url
}
/-/survey_responses?
#{
params
.
to_query
}
"
end
def
feedback_ratings
(
rating
)
...
...
lib/gitlab/saas.rb
0 → 100644
View file @
fe145c6f
# frozen_string_literal: true
# This module is used to return various SaaS related configurations
# which may be overridden in other variants of GitLab
module
Gitlab
module
Saas
def
self
.
com_url
'https://gitlab.com'
end
def
self
.
staging_com_url
'https://staging.gitlab.com'
end
def
self
.
subdomain_regex
%r{
\A
https://[a-z0-9]+
\.
gitlab
\.
com
\z
}
.
freeze
end
def
self
.
dev_url
'https://dev.gitlab.org'
end
end
end
Gitlab
::
Saas
.
prepend_mod
spec/lib/gitlab/tracking/standard_context_spec.rb
View file @
fe145c6f
...
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do
context
'staging'
do
before
do
stub_config_setting
(
url:
'https://staging.gitlab.com'
)
stub_config_setting
(
url:
Gitlab
::
Saas
.
staging_com_url
)
end
include_examples
'contains environment'
,
'staging'
...
...
@@ -30,7 +30,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do
context
'production'
do
before
do
stub_config_setting
(
url:
'https://gitlab.com'
)
stub_config_setting
(
url:
Gitlab
::
Saas
.
com_url
)
end
include_examples
'contains environment'
,
'production'
...
...
@@ -38,7 +38,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do
context
'org'
do
before
do
stub_config_setting
(
url:
'https://dev.gitlab.org'
)
stub_config_setting
(
url:
Gitlab
::
Saas
.
dev_url
)
end
include_examples
'contains environment'
,
'org'
...
...
spec/lib/gitlab_spec.rb
View file @
fe145c6f
...
...
@@ -70,20 +70,21 @@ RSpec.describe Gitlab do
end
describe
'.com?'
do
it
'is true when on GitLab.com'
do
stub_config_setting
(
url:
'https://gitlab.com'
)
it
"is true when on
#{
Gitlab
::
Saas
.
com_url
}
"
do
stub_config_setting
(
url:
Gitlab
::
Saas
.
com_url
)
expect
(
described_class
.
com?
).
to
eq
true
end
it
'is true when on staging'
do
stub_config_setting
(
url:
'https://staging.gitlab.com'
)
it
"is true when on
#{
Gitlab
::
Saas
.
staging_com_url
}
"
do
stub_config_setting
(
url:
Gitlab
::
Saas
.
staging_com_url
)
expect
(
described_class
.
com?
).
to
eq
true
end
it
'is true when on other gitlab subdomain'
do
stub_config_setting
(
url:
'https://example.gitlab.com'
)
url_with_subdomain
=
Gitlab
::
Saas
.
com_url
.
gsub
(
'https://'
,
'https://example.'
)
stub_config_setting
(
url:
url_with_subdomain
)
expect
(
described_class
.
com?
).
to
eq
true
end
...
...
@@ -118,14 +119,14 @@ RSpec.describe Gitlab do
describe
'.staging?'
do
subject
{
described_class
.
staging?
}
it
'is false when on GitLab.com'
do
stub_config_setting
(
url:
'https://gitlab.com'
)
it
"is false when on
#{
Gitlab
::
Saas
.
com_url
}
"
do
stub_config_setting
(
url:
Gitlab
::
Saas
.
com_url
)
expect
(
subject
).
to
eq
false
end
it
'is true when on staging'
do
stub_config_setting
(
url:
'https://staging.gitlab.com'
)
it
"is true when on
#{
Gitlab
::
Saas
.
staging_com_url
}
"
do
stub_config_setting
(
url:
Gitlab
::
Saas
.
staging_com_url
)
expect
(
subject
).
to
eq
true
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment