Class: Kaiser::Cmds::Set
- Inherits:
-
Kaiser::Cli
- Object
- Kaiser::Cli
- Kaiser::Cmds::Set
- Defined in:
- lib/kaiser/cmds/set.rb
Instance Attribute Summary
Attributes inherited from Kaiser::Cli
Instance Method Summary collapse
- #execute(_opts) ⇒ Object
-
#initialize ⇒ Set
constructor
A new instance of Set.
- #usage ⇒ Object
Methods inherited from Kaiser::Cli
all_subcommands_usage, #define_options, register, run_command, #set_config, #start_services, #stop_app, #stop_services
Methods included from Kaiser::CliOptions
Constructor Details
#initialize ⇒ Set
Returns a new instance of Set.
24 25 26 27 |
# File 'lib/kaiser/cmds/set.rb', line 24 def initialize super @use_kaiserfile = false end |
Instance Method Details
#execute(_opts) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/kaiser/cmds/set.rb', line 29 def execute(_opts) cmd = ARGV.shift case cmd when 'cert-url' Config.config[:cert_source] = { url: ARGV.shift } when 'cert-folder' Config.config[:cert_source] = { folder: ARGV.shift } when 'http-suffix' Config.config[:http_suffix] = ARGV.shift when 'help-https' puts <<~SET_HELP Notes on HTTPS: You need to set suffix and either cert-url or cert-folder to enable HTTPS. cert-url and cert-folder are mutually exclusive. If you set one of them the other will be erased. The cert-url and cert-folder must satisfy the following requirements to work: The strings must be the root of certificates named after the suffix. For example, if cert-url is https://mydomain.com/certs and your suffix is local.mydomain.com, the following url need to be the certificate files: https://mydomain.com/certs/local.mydomain.com.chain.pem https://mydomain.com/certs/local.mydomain.com.crt https://mydomain.com/certs/local.mydomain.com.key Another example: If you use suffix of localme.com and cert-folder is /home/me/https, The following files need to exist: /home/me/https/localme.com.chain.pem /home/me/https/localme.com.crt /home/me/https/localme.com.key SET_HELP else Optimist.die "Unknown subcommand: '#{cmd}'" end save_config end |
#usage ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kaiser/cmds/set.rb', line 6 def usage <<~EOS This command lets you set up special variables that configure kaiser's behavior for you. Available subcommands: http-suffix - Sets the domain suffix for the reverse proxy to use (defaults to lvh.me) cert-url - Sets up a URL from which HTTPS certificates can be downloaded. cert-folder - Sets up a folder from which HTTPS certificates can be copied. help-https - Shows the HTTPS notes. USAGE: kaiser set cert-url kaiser set cert-folder kaiser set http-suffix kaiser set help-https EOS end |