Sha256: 1c9f75fba078094c039c52b243263f334c1039b5e3124cfbaade3894fec33324
Contents?: true
Size: 803 Bytes
Versions: 20
Compression:
Stored size: 803 Bytes
Contents
module Gitea module Api class Config < Common::Struct::Base attrs :domain, :base_url, :username, :password, :token, :open_timeout, :read_timeout, :log_filepath def initialize(opts = {}) super(opts) valid! normalize_domain end private def valid! if @domain.nil? || @base_url.nil? fail Exception, "@domain, @base_url not permit blank." end end def normalize_domain uri = URI.parse(domain) uri = URI.parse(domain) uri = URI.parse("http://#{domain}") unless uri.scheme if uri.scheme != 'http' and uri.scheme != 'https' fail ClientError, "Only HTTP and HTTPS domain are accepted." end @domain = uri end end end # Common end # Gitea
Version data entries
20 entries across 20 versions & 1 rubygems