Class: VagrantPlugins::OrbStack::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::OrbStack::Config
- Defined in:
- lib/vagrant-orbstack/config.rb
Overview
Configuration class for OrbStack provider.
This class defines configuration options available in Vagrantfiles for customizing OrbStack machine creation and behavior.
Constant Summary collapse
- DISTRO_EMPTY_ERROR =
Error message constants for validation
'distro cannot be empty'- MACHINE_NAME_FORMAT_ERROR =
'machine_name must contain only alphanumeric characters and hyphens'- SSH_USERNAME_EMPTY_ERROR =
'ssh_username cannot be empty'- FORWARD_AGENT_BOOLEAN_ERROR =
'forward_agent must be a boolean (true or false)'- MACHINE_NAME_PATTERN =
Regular expression pattern for valid machine_name format.
Valid machine names must:
- Start with an alphanumeric character (a-z, A-Z, 0-9)
- End with an alphanumeric character
- May contain hyphens between alphanumeric segments
- No consecutive hyphens allowed
/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/
Instance Attribute Summary collapse
-
#distro ⇒ String?
Linux distribution to use for the machine.
-
#forward_agent ⇒ Boolean?
Enable SSH agent forwarding.
-
#machine_name ⇒ String?
Custom name for the OrbStack machine.
-
#ssh_username ⇒ String?
Custom SSH username for connecting to the machine.
-
#version ⇒ String?
Distribution version to use.
Instance Method Summary collapse
-
#finalize! ⇒ Object
Finalize configuration by setting defaults.
-
#initialize ⇒ Config
constructor
Initialize configuration with unset values.
-
#validate(_machine) ⇒ Hash<String, Array<String>>
Validate configuration values.
Constructor Details
#initialize ⇒ Config
Initialize configuration with unset values.
68 69 70 71 72 73 74 75 76 |
# File 'lib/vagrant-orbstack/config.rb', line 68 def initialize super @distro = VagrantPlugins::OrbStack::UNSET_VALUE @version = VagrantPlugins::OrbStack::UNSET_VALUE @machine_name = VagrantPlugins::OrbStack::UNSET_VALUE @ssh_username = VagrantPlugins::OrbStack::UNSET_VALUE @forward_agent = VagrantPlugins::OrbStack::UNSET_VALUE @logger = Log4r::Logger.new('vagrant_orbstack::config') end |
Instance Attribute Details
#distro ⇒ String?
Linux distribution to use for the machine
47 48 49 |
# File 'lib/vagrant-orbstack/config.rb', line 47 def distro @distro end |
#forward_agent ⇒ Boolean?
Enable SSH agent forwarding
47 |
# File 'lib/vagrant-orbstack/config.rb', line 47 attr_accessor :distro |
#machine_name ⇒ String?
Custom name for the OrbStack machine
47 |
# File 'lib/vagrant-orbstack/config.rb', line 47 attr_accessor :distro |
#ssh_username ⇒ String?
Custom SSH username for connecting to the machine
47 |
# File 'lib/vagrant-orbstack/config.rb', line 47 attr_accessor :distro |
#version ⇒ String?
Distribution version to use
47 |
# File 'lib/vagrant-orbstack/config.rb', line 47 attr_accessor :distro |
Instance Method Details
#finalize! ⇒ Object
Finalize configuration by setting defaults.
Called by Vagrant after Vagrantfile is loaded to set default values for any unset configuration options.
84 85 86 87 88 89 90 |
# File 'lib/vagrant-orbstack/config.rb', line 84 def finalize! @distro = 'ubuntu' if @distro == VagrantPlugins::OrbStack::UNSET_VALUE @version = nil if @version == VagrantPlugins::OrbStack::UNSET_VALUE @machine_name = nil if @machine_name == VagrantPlugins::OrbStack::UNSET_VALUE @ssh_username = nil if @ssh_username == VagrantPlugins::OrbStack::UNSET_VALUE @forward_agent = false if @forward_agent == VagrantPlugins::OrbStack::UNSET_VALUE end |
#validate(_machine) ⇒ Hash<String, Array<String>>
Validate configuration values.
97 98 99 100 101 102 103 104 |
# File 'lib/vagrant-orbstack/config.rb', line 97 def validate(_machine) errors = _detected_errors validate_distro(errors) validate_machine_name(errors) validate_ssh_username(errors) validate_forward_agent(errors) { 'OrbStack Provider' => errors } end |