diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index 6108697bc2012e22d96896194df7c7cadbc5b125..7479e729db14421948590b64c3cffbfec2c1297f 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -1,4 +1,7 @@
 require 'gitlab/git'
 
 module Gitlab
+  def self.com?
+    Gitlab.config.gitlab.url == 'https://gitlab.com'
+  end
 end
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..c59dfea5c55f1dce507915547fcff4ee8f2541a6
--- /dev/null
+++ b/spec/lib/gitlab_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+describe Gitlab, lib: true do
+  describe '.com?' do
+    it 'is true when on GitLab.com' do
+      stub_config_setting(url: 'https://gitlab.com')
+
+      expect(described_class.com?).to eq true
+    end
+
+    it 'is false when not on GitLab.com' do
+      stub_config_setting(url: 'http://example.com')
+
+      expect(described_class.com?).to eq false
+    end
+  end
+end