Module: DataTaster::Helper
- Included in:
- Flavors
- Defined in:
- lib/data_taster/helper.rb
Overview
helpers used globally in DataTaster
Instance Method Summary collapse
Instance Method Details
#db_config ⇒ Object
16 17 18 |
# File 'lib/data_taster/helper.rb', line 16 def db_config ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: "primary").configuration_hash end |
#logg(message) ⇒ Object
20 21 22 |
# File 'lib/data_taster/helper.rb', line 20 def logg() DataTaster.logger.debug { "[#{Time.current}] #{}" } end |
#sanitize_command(command, params = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/data_taster/helper.rb', line 6 def sanitize_command(command, params = nil) sanitized_command = command.gsub(Shellwords.escape(ENV.fetch("DEV_DUMP_USER", nil)), "<username>") .gsub(Shellwords.escape(ENV.fetch("DEV_DUMP_PASSWORD", nil)), "<pwd>") .gsub(ENV.fetch("DEV_DUMP_PASSWORD", nil), "<pwd>") sanitized_command = sanitized_command.gsub(Shellwords.escape(params["password"]), "<pwd>") if params sanitized_command end |