Top Level Namespace
Defined Under Namespace
Modules: Topsdk
Constant Summary collapse
- RAILS_ENV =
PADRINO_ENV
Instance Method Summary collapse
Instance Method Details
#apply_settings ⇒ Object
賦值
8 9 10 11 12 13 14 15 16 |
# File 'lib/topsdk.rb', line 8 def apply_settings @settings = YAML.load_file(config_file) @settings = defined?(RAILS_ENV) ? @settings[RAILS_ENV] : @settings['development'] ENV['TAOBAO_APP_KEY'] = @settings['api_key'].to_s ENV['TAOBAO_APP_SECRET'] = @settings['secret_key'] ENV['TAOBAO_AUTH_URL'] = @settings['auth_url'] ENV['TAOBAO_REST_URL'] = @settings['rest_url'] ENV['TAOBAO_XML_ONLY'] = @settings['black_list'] end |
#config_file ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/topsdk.rb', line 18 def config_file # 解析配置文件 yml_file = File.(File.join('.', 'config', 'taobao.yml')) unless File.exist?(yml_file) File.(File.join('config', 'taobao.yml'), File.dirname(__FILE__)) else yml_file end end |