Sha256: 8b9359fae19d8bb4ffa341df21b1a05e5d136484b9d4da34d81beb61d6871b08
Contents?: true
Size: 1000 Bytes
Versions: 23
Compression:
Stored size: 1000 Bytes
Contents
# frozen_string_literal: true module KnapsackPro module Crypto class BranchEncryptor NON_ENCRYPTABLE_BRANCHES = [ 'master', 'main', 'develop', 'development', 'dev', 'staging', 'production', # GitHub Actions has branch names starting with refs/heads/ 'refs/heads/master', 'refs/heads/main', 'refs/heads/develop', 'refs/heads/development', 'refs/heads/dev', 'refs/heads/staging', 'refs/heads/production', ] def self.call(branch) if KnapsackPro::Config::Env.branch_encrypted? new(branch).call else branch end end def initialize(branch) @branch = branch end def call if NON_ENCRYPTABLE_BRANCHES.include?(branch) branch else Digestor.salt_hexdigest(branch)[0..6] end end private attr_reader :branch end end end
Version data entries
23 entries across 23 versions & 1 rubygems