Class: Shai::Configuration
- Inherits:
-
Object
- Object
- Shai::Configuration
- Defined in:
- lib/shai/configuration.rb
Defined Under Namespace
Classes: InsecureConnectionError
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#config_dir ⇒ Object
Returns the value of attribute config_dir.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #color_enabled? ⇒ Boolean
- #credentials_path ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 |
# File 'lib/shai/configuration.rb', line 12 def initialize self.api_url = ENV.fetch("SHAI_API_URL", "https://shaicli.dev") @config_dir = (ENV.fetch("SHAI_CONFIG_DIR", default_config_dir)) @token = ENV["SHAI_TOKEN"] end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
10 11 12 |
# File 'lib/shai/configuration.rb', line 10 def api_url @api_url end |
#config_dir ⇒ Object
Returns the value of attribute config_dir.
9 10 11 |
# File 'lib/shai/configuration.rb', line 9 def config_dir @config_dir end |
#token ⇒ Object
Returns the value of attribute token.
9 10 11 |
# File 'lib/shai/configuration.rb', line 9 def token @token end |
Instance Method Details
#color_enabled? ⇒ Boolean
27 28 29 |
# File 'lib/shai/configuration.rb', line 27 def color_enabled? !ENV.key?("NO_COLOR") end |
#credentials_path ⇒ Object
23 24 25 |
# File 'lib/shai/configuration.rb', line 23 def credentials_path File.join(config_dir, "credentials") end |