Sha256: c9d0fce6314116e3112b9302a307c9c92806e12c5c9cb4338db1666956aab406

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module RubyEasyRSA
  module Commands
    module Mixins
      module AlgorithmConfig
        private

        # rubocop:disable Style/RedundantAssignment
        def configure_command(initial_builder, parameters)
          builder = super
          builder = with_ec_directory(builder, parameters[:ec_directory])
          builder = with_algorithm(builder, parameters[:algorithm])
          builder = with_curve(builder, parameters[:curve])
          builder
        end
        # rubocop:enable Style/RedundantAssignment

        def with_ec_directory(builder, ec_directory)
          return builder unless ec_directory

          builder.with_environment_variable(
            'EASYRSA_EC_DIR', ec_directory
          )
        end

        def with_algorithm(builder, algorithm)
          return builder unless algorithm

          builder.with_option('--use-algo', algorithm)
        end

        def with_curve(builder, curve)
          return builder unless curve

          builder.with_option('--curve', curve)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_easy_rsa-0.14.0.pre.2 lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb
ruby_easy_rsa-0.14.0.pre.1 lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb
ruby_easy_rsa-0.13.0 lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb
ruby_easy_rsa-0.12.0.pre.7 lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb
ruby_easy_rsa-0.12.0.pre.6 lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb
ruby_easy_rsa-0.12.0.pre.5 lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb