Class: Authn::TokenField::PrefixHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/authn/token_field/prefix_helper.rb

Class Method Summary collapse

Class Method Details

.instance_prefixObject



13
14
15
16
17
18
19
# File 'lib/authn/token_field/prefix_helper.rb', line 13

def self.instance_prefix
  # This is an admin setting, so we should go with :instance
  # https://docs.gitlab.com/ee/development/feature_flags/#instance-actor
  return '' unless Feature.enabled?(:custom_prefix_for_all_token_types, :instance)

  Gitlab::CurrentSettings.current_application_settings.instance_token_prefix
end

.prepend_instance_prefix(prefix) ⇒ Object



6
7
8
9
10
11
# File 'lib/authn/token_field/prefix_helper.rb', line 6

def self.prepend_instance_prefix(prefix)
  return prefix unless Feature.enabled?(:custom_prefix_for_all_token_types, :instance)
  return prefix unless instance_prefix.present?

  "#{instance_prefix}-#{prefix}"
end