Sha256: 9b71dbeb806779bfabf01ab987e8149bc628c1d5a02ff0a6ca86000976e240b8

Contents?: true

Size: 886 Bytes

Versions: 6

Compression:

Stored size: 886 Bytes

Contents

# frozen_string_literal: true

require 'yaml'
require 'erb'
require 'logger'

require 'shale'

require_relative 'type'

::Dir[::File.expand_path('configuration/*.rb', __dir__)].sort.each { require _1 }

module Capistrano
  module DataPlaneApi
    # Configuration object of the `capistrano-data_plane_api` gem.
    class Configuration < Type
      attribute :api_url, ::Shale::Type::String
      attribute :logger_level, ::Shale::Type::Integer, default: -> { ::Logger::DEBUG }
      attribute :backends, Backend, collection: true
      attribute :file_path, ::Shale::Type::String
      attribute :basic_user, ::Shale::Type::String
      attribute :basic_password, ::Shale::Type::String

      class << self
        # @param path [String]
        # @return [self]
        def from_file(path)
          from_yaml ::ERB.new(::File.read(path)).result
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
capistrano-data_plane_api-0.1.5 lib/capistrano/data_plane_api/configuration.rb
capistrano-data_plane_api-0.1.4 lib/capistrano/data_plane_api/configuration.rb
capistrano-data_plane_api-0.1.3 lib/capistrano/data_plane_api/configuration.rb
capistrano-data_plane_api-0.1.2 lib/capistrano/data_plane_api/configuration.rb
capistrano-data_plane_api-0.1.1 lib/capistrano/data_plane_api/configuration.rb
capistrano-data_plane_api-0.1.0 lib/capistrano/data_plane_api/configuration.rb