Class: Xolo::Admin::Configuration
- Inherits:
-
Core::BaseClasses::Configuration
- Object
- Core::BaseClasses::Configuration
- Xolo::Admin::Configuration
- Includes:
- Singleton
- Defined in:
- lib/xolo/admin/configuration.rb
Overview
Personal prefs for users of ‘xadm’
Constant Summary collapse
- CONF_FILE_DIR =
Constants
'~/Library/Preferences/'- CONF_FILENAME =
'com.pixar.xolo.admin.config.yaml'- CREDENTIALS_NEEDED =
'<credentials needed>'- CREDENTIALS_IN_KEYCHAIN =
'<stored in keychain>'- CREDENTIALS_STORED =
'<stored>'- KEYS =
See Xolo::Core::BaseClasses::Configuration for required values when used to access the config file.
Also adds values used for CLI and walktru, as with the ATTRIBUTES of Xolo::Core::BaseClasses::Title and Xolo::Core::BaseClasses::Version
{ # @!attribute hostname # @return [String] hostname: { required: true, label: 'Xolo Server Hostname', type: :string, validate: true, invalid_msg: "Invalid hostname, can't connect, or not a Xolo server.", desc: <<~ENDDESC The hostname of the Xolo Server to interact with, e.g. 'xolo.myschool.edu' Enter 'x' to exit if no attempts are successful. ENDDESC }, # @!attribute admin # @return [String] admin: { required: true, label: 'Username', type: :string, validate: false, desc: <<~ENDDESC The Xolo admin username for connecting to the Xolo server. The same that you would use to connect to Jamf Pro. ENDDESC }, # @!attribute pw # @return [String] pw: { required: true, label: 'Password', type: :string, validate: true, walkthru_na: :pw_na, secure_interactive_input: true, invalid_msg: 'Incorrect username or password, or user not allowed.', desc: <<~ENDDESC The password for connecting to the Xolo server. The same that you would use to connect to Jamf Pro. It will be stored in your login keychain for use in your terminal or other MacOS GUI applications, such as XCode. If you are configuring a non-GUI environment, such as a CI workflow, set 'Non-GUI mode' to true. See the 'Non-GUI mode' option below for details Enter 'x' to exit if you are in an unknown password loop. ENDDESC }, # @!attribute pw # @return [String] ssl_verify: { label: 'Verify SSL Cert', type: :boolean, invalid_msg: '', validate: :validate_boolean, default: true, desc: <<~ENDDESC If your Xolo server is using a self-signed SSL certificate, set this to false, to disable SSL verification. Defaults to true, which is recommended for production servers. ENDDESC }, # @!attribute pw # @return [String] no_gui: { required: false, label: 'Non-GUI mode', type: :boolean, validate: :validate_boolean, walkthru_na: :pw_na, secure_interactive_input: true, desc: <<~ENDDESC If you are configuring xadm for a non-GUI environment, such as a CI workflow, set this to true. This will prevent xadm from trying to access the keychain. The password value can then be set to: - A command prefixed with '|' that will be executed to get the password from stdout. This can have any CLI options and arguments you need to get the password. This is useful when using a secret-storage system to manage secrets. - A path to an executable file that returns the password to stdout. No arguments are passed, the file is just executed. The file must have only rwx permissions for the user running xadm, i.e. mode 0700. - A path to a readable file containing the password, which must have only rw permissions for the user running xadm, i.e. mode 0600. - Or the password itself, which will be stored in the xadm config file WARNING: Be careful when storing passwords in files. ENDDESC }, # @!attribute pw # @return [String] editor: { label: 'Preferred editor', type: :string, validate: true, invalid_msg: 'That editor does not exist, or is not executable.', desc: <<~ENDDESC The editor to use for interactively editing descriptions and other multi-line text. Enter the full path to an editor, such as '/usr/bin/vim'. It must take the name of a file to edit as an argument. GUI editors are supported, such as /usr/local/bin/bbedit. They will be launched as needed when editing multi-line text. Note that you may need to provide a command line option to the editor to make the cli process wait for the GUI editor to finish. For example, the -w option for bbedit. If no editor is set in your config, you will be asked to use one of a few basic ones. ENDDESC } }.freeze
Constants inherited from Core::BaseClasses::Configuration
Core::BaseClasses::Configuration::PIPE, Core::BaseClasses::Configuration::PRIVATE
Instance Attribute Summary collapse
Attributes inherited from Core::BaseClasses::Configuration
Class Method Summary collapse
-
.cli_opts ⇒ Hash{Symbol: Hash}
The KEYS that are available as CLI & walkthru options with the ‘xadm config’ command.
-
.help_desc_text ⇒ Object
The help text for the ‘xadm config’ command.
Instance Method Summary collapse
-
#conf_file ⇒ Pathname
The file that stores configuration values.
Methods inherited from Core::BaseClasses::Configuration
#data_from_command_file_or_string, inherited, #initialize, #save_to_file, #to_h, #to_h_private
Constructor Details
This class inherits a constructor from Xolo::Core::BaseClasses::Configuration
Instance Attribute Details
#admin ⇒ String
|
|
# File 'lib/xolo/admin/configuration.rb', line 61
|
#hostname ⇒ String
|
|
# File 'lib/xolo/admin/configuration.rb', line 46
|
#pw ⇒ String
|
|
# File 'lib/xolo/admin/configuration.rb', line 74
|
Class Method Details
.cli_opts ⇒ Hash{Symbol: Hash}
The KEYS that are available as CLI & walkthru options with the ‘xadm config’ command.
179 180 181 |
# File 'lib/xolo/admin/configuration.rb', line 179 def self.cli_opts KEYS end |
.help_desc_text ⇒ Object
The help text for the ‘xadm config’ command. Needed because none of the options are available as CLI options.
187 188 189 190 191 192 193 194 195 196 |
# File 'lib/xolo/admin/configuration.rb', line 187 def self.help_desc_text text = +'' KEYS.each_value do |value| text += <<~ENDDESC #{value[:label]}: #{value[:desc].lines.map { |l| " #{l}" }.join} ENDDESC end text end |
Instance Method Details
#conf_file ⇒ Pathname
Returns The file that stores configuration values.
204 205 206 |
# File 'lib/xolo/admin/configuration.rb', line 204 def conf_file @conf_file ||= Pathname.new("#{CONF_FILE_DIR}#{CONF_FILENAME}"). end |