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