Sha256: 37a7cf3d04b6cd51429537354e5a986b719ae59da14a1f948924a6ee9810cda3

Contents?: true

Size: 1.12 KB

Versions: 49

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true
require 'yaml'
require 'lhj/config'

module Lhj
  class OSSConfig
    def self.config_file
      file = 'oss_config.yml'
      File.expand_path("#{Lhj::Config.instance.home_dir}/#{file}")
    end

    def self.config
      @yaml ||= YAML.load_file(config_file)
    end

    def self.clean
      @yaml = nil
    end

    def self.oss_endpoint
      config['oss_endpoint']
    end

    def self.oss_endpoint=(endpoint)
      config['oss_endpoint'] = endpoint
    end

    def self.oss_access_key_id
      config['oss_access_key_id']
    end

    def self.oss_access_key_secret
      config['oss_access_key_secret']
    end

    def self.oss_bucket
      config['oss_bucket']
    end

    def self.oss_bucket=(bucket)
      config['oss_bucket'] = bucket
    end

    def self.oss_domain
      config['oss_domain']
    end

    def self.oss_domain=(domain)
      config['oss_domain'] = domain
    end

    def self.oss_bucket_list
      config['oss_bucket_list']
    end

    def self.save
      file_to_save = File.open(config_file, 'w+')
      YAML.dump(config, file_to_save)
      file_to_save.close
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
lhj-tools-0.2.65 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.64 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.63 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.62 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.61 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.60 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.59 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.58 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.57 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.56 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.55 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.54 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.53 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.52 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.51 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.50 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.49 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.48 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.47 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.46 lib/lhj/helper/oss_config.rb