Class: Daytona::Config
- Inherits:
-
Object
- Object
- Daytona::Config
- Defined in:
- lib/daytona/config.rb
Constant Summary collapse
- API_URL =
'https://app.daytona.io/api'
Instance Attribute Summary collapse
-
#_experimental ⇒ Hash?
Experimental configuration options.
-
#api_key ⇒ String?
API key for authentication with the Daytona API.
-
#api_url ⇒ String?
URL of the Daytona API.
-
#jwt_token ⇒ String?
JWT token for authentication with the Daytona API.
-
#organization_id ⇒ String?
Organization ID for authentication with the Daytona API.
-
#target ⇒ String?
Target environment for sandboxes.
Instance Method Summary collapse
-
#initialize(api_key: nil, jwt_token: nil, api_url: nil, organization_id: nil, target: nil, _experimental: nil) ⇒ Config
constructor
Initializes a new Daytona::Config object.
-
#read_env(name) ⇒ String?
Reads a DAYTONA_-prefixed environment variable using the same precedence as the Config initializer: runtime ENV first, then .env.local, then .env.
Constructor Details
#initialize(api_key: nil, jwt_token: nil, api_url: nil, organization_id: nil, target: nil, _experimental: nil) ⇒ Config
Initializes a new Daytona::Config object.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/daytona/config.rb', line 47 def initialize( # rubocop:disable Metrics/ParameterLists api_key: nil, jwt_token: nil, api_url: nil, organization_id: nil, target: nil, _experimental: nil ) @env_reader = daytona_env_reader @api_key = api_key || @env_reader.call('DAYTONA_API_KEY') @jwt_token = jwt_token || @env_reader.call('DAYTONA_JWT_TOKEN') @api_url = api_url || @env_reader.call('DAYTONA_API_URL') || API_URL @target = target || @env_reader.call('DAYTONA_TARGET') @organization_id = organization_id || @env_reader.call('DAYTONA_ORGANIZATION_ID') @_experimental = _experimental end |
Instance Attribute Details
#_experimental ⇒ Hash?
Experimental configuration options
37 38 39 |
# File 'lib/daytona/config.rb', line 37 def _experimental @_experimental end |
#api_key ⇒ String?
API key for authentication with the Daytona API
12 13 14 |
# File 'lib/daytona/config.rb', line 12 def api_key @api_key end |
#api_url ⇒ String?
URL of the Daytona API
22 23 24 |
# File 'lib/daytona/config.rb', line 22 def api_url @api_url end |
#jwt_token ⇒ String?
JWT token for authentication with the Daytona API
17 18 19 |
# File 'lib/daytona/config.rb', line 17 def jwt_token @jwt_token end |
#organization_id ⇒ String?
Organization ID for authentication with the Daytona API
27 28 29 |
# File 'lib/daytona/config.rb', line 27 def organization_id @organization_id end |
#target ⇒ String?
Target environment for sandboxes
32 33 34 |
# File 'lib/daytona/config.rb', line 32 def target @target end |
Instance Method Details
#read_env(name) ⇒ String?
Reads a DAYTONA_-prefixed environment variable using the same precedence as the Config initializer: runtime ENV first, then .env.local, then .env. Only names starting with DAYTONA_ are accepted.
72 73 74 |
# File 'lib/daytona/config.rb', line 72 def read_env(name) @env_reader.call(name) end |