Class: Awssh::Config
- Inherits:
-
Object
- Object
- Awssh::Config
- Defined in:
- lib/awssh/config.rb
Constant Summary collapse
- DEFAULT =
<<-EOF --- region: us-east-1 # AWS Region key: AWS_ACCESS_KEY_ID # AWS access key id secret: AWS_SECRET_ACCESS_KEY # AWS secret access key multi: csshX # command to use when connecting to multiple servers single: ssh # command to use when connecting to single server #user: username # set user for connection to all servers # this can be overridden on the command line domain: example.com # if 'use_names' is set, this will be appended # to names, leave blank if name is fully-qualified use_names: false # if true, rather than connecting to IP's, # connection strings will be created using Name # tag and domain cache: ~/.awssh.cache # the cache file, set to false to disable caching expires: 86400 # cache expiration time in seconds EOF
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(file) ⇒ Config
Returns a new instance of Config.
19 20 21 22 23 |
# File 'lib/awssh/config.rb', line 19 def initialize(file) @file = File.(file) yaml = File.exist?(@file) ? YAML.load_file(file) : {} @data = OpenStruct.new(yaml) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
17 18 19 |
# File 'lib/awssh/config.rb', line 17 def data @data end |
Class Method Details
.data ⇒ Object
11 12 13 14 |
# File 'lib/awssh/config.rb', line 11 def data raise 'config not loaded?' unless @instance.data @instance.data end |
.load(file) ⇒ Object
7 8 9 |
# File 'lib/awssh/config.rb', line 7 def load(file) @instance = new(file) end |