Sha256: 37a7cf3d04b6cd51429537354e5a986b719ae59da14a1f948924a6ee9810cda3

Contents?: true

Size: 1.12 KB

Versions: 47

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

47 entries across 47 versions & 1 rubygems

Version Path
lhj-tools-0.2.83 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.82 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.81 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.80 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.79 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.78 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.77 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.76 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.75 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.74 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.73 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.72 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.71 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.70 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.69 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.68 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.67 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.66 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.65 lib/lhj/helper/oss_config.rb
lhj-tools-0.2.64 lib/lhj/helper/oss_config.rb