Sha256: 65558340ff37976945c8e19f6952a7b5da51bad3acaf3a38c8657fd576c0d1ec
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require 'dry-types' require 'dry-struct' class PgExport class Configuration < Dry::Struct include Dry::Types.module attribute :dump_encryption_key, Strict::String.constrained(size: 16) attribute :ftp_host, Strict::String attribute :ftp_user, Strict::String attribute :ftp_password, Strict::String attribute :logger_format, Coercible::String.enum('plain', 'timestamped', 'muted') attribute :keep_dumps, Coercible::Int.constrained(gteq: 0) def self.build(env) new( dump_encryption_key: env['DUMP_ENCRYPTION_KEY'], ftp_host: env['BACKUP_FTP_HOST'], ftp_user: env['BACKUP_FTP_USER'], ftp_password: env['BACKUP_FTP_PASSWORD'], logger_format: env['LOGGER_FORMAT'] || 'plain', keep_dumps: env['KEEP_DUMPS'] || 10 ) rescue Dry::Struct::Error => e raise PgExport::InitializationError, e.message.gsub('[PgExport::Configuration.new] ', '') end def logger_muted? logger_format == 'muted' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pg_export-0.7.5 | lib/pg_export/configuration.rb |