Module: Parse::Stack
- Defined in:
- lib/parse/stack/version.rb,
lib/parse/stack.rb,
lib/parse/stack/tasks.rb,
lib/parse/stack/railtie.rb
Overview
The Parse Server SDK for Ruby
Defined Under Namespace
Constant Summary collapse
- VERSION =
The current version.
"1.7.3"
Class Method Summary collapse
-
.hyperdrive_config!(url = nil) ⇒ Boolean
Applies a remote JSON hash containing the ENV keys and values from a remote URL.
-
.load_tasks ⇒ Object
Loads and installs all Parse::Stack related tasks in a rake file.
Class Method Details
.hyperdrive_config!(url = nil) ⇒ Boolean
Applies a remote JSON hash containing the ENV keys and values from a remote URL. Values from the JSON hash are only applied to the current ENV hash ONLY if it does not already have a value. Therefore local ENV values will take precedence over remote ones. By default, it uses the url in environment value in ‘CONFIG_URL’ or ‘HYPERDRIVE_URL’.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/parse/stack.rb', line 20 def self.hyperdrive_config!(url = nil) url ||= ENV["HYPERDRIVE_URL"] || ENV['CONFIG_URL'] if url.present? begin remote_config = JSON.load open( url ) remote_config.each do |key,value| k = key.upcase next unless ENV[k].nil? ENV[k] ||= value.to_s end return true rescue => e warn "[Parse::Stack] Error loading config: #{url} (#{e})" end end false end |
.load_tasks ⇒ Object
Loads and installs all Parse::Stack related tasks in a rake file.
15 16 17 |
# File 'lib/parse/stack/tasks.rb', line 15 def self.load_tasks Parse::Stack::Tasks.new.install_tasks end |