Sha256: 18d83ba0f718e8059d8209d24c9aa3388b0bb664ab77bde6e713e340ad6bad86
Contents?: true
Size: 1.37 KB
Versions: 75
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module Cryptum # This module is used to Accept User Input at Session Initiation module Option # Common module to consume YAML config and determine which environment to use. module Environment # Initialize Cryptum Session Environment public_class_method def self.get(opts = {}) option_choice = opts[:option_choice] yaml_conf_file = "#{option_choice.session_root}/etc/coinbase_pro.yaml" yaml_conf = YAML.load_file( yaml_conf_file, symbolize_names: true ) env = yaml_conf[:prod] env[:env] = :prod env = yaml_conf[:sandbox] if option_choice.sandbox env[:env] = :sandbox if option_choice.sandbox open_ai_yaml_conf_file = "#{option_choice.session_root}/etc/open_ai.yaml" if File.exist?(open_ai_yaml_conf_file) open_ai_yaml_conf = YAML.load_file( open_ai_yaml_conf_file, symbolize_names: true ) env[:open_ai_bearer_token] = open_ai_yaml_conf[:bearer_token] end env rescue Interrupt, StandardError => e Cryptum::Log.append(level: :error, msg: e, which_self: self) end # Display Usage for this Module public_class_method def self.help puts "USAGE: #{self}.get(option_choice: option_choice) " end end end end
Version data entries
75 entries across 75 versions & 1 rubygems