Sha256: 884b47d81c7a7c65b6e2c2fc6a11c62fd99499426abef34740a013c1d73608c6

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

module FastCI
  class Configuration
    attr_accessor :run_key, :build_id, :commit, :branch, :api_url, :secret_key

    def initialize
      # Settings defaults
      self.run_key = nil
      self.build_id = ENV.fetch("BUILD_ID")
      self.commit = `git rev-parse --short HEAD`.chomp
      self.branch = `git rev-parse --abbrev-ref HEAD`.chomp
      self.api_url = ENV["FAST_CI_API_URL"] || "api.fast.ci"
      self.secret_key = ENV.fetch("FAST_CI_SECRET_KEY")
    end

    def reset
      initialize
    end

    def run_key
      @run_key || raise("#run_key was not configured.")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fast_ci-0.1.0 lib/fast_ci/configuration.rb