Class: Heighliner::Cmds::Set

Inherits:
Heighliner::Cli show all
Defined in:
lib/heighliner/cmds/set.rb

Instance Attribute Summary

Attributes inherited from Heighliner::Cli

#use_steerfile

Instance Method Summary collapse

Methods inherited from Heighliner::Cli

all_subcommands_usage, #define_options, register, run_command, #set_config, #start_services, #stop_app, #stop_services

Methods included from Heighliner::CliOptions

#option, #options

Constructor Details

#initializeSet

Returns a new instance of Set.



30
31
32
33
# File 'lib/heighliner/cmds/set.rb', line 30

def initialize
  super
  @use_steerfile = false
end

Instance Method Details

#execute(_opts) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/heighliner/cmds/set.rb', line 35

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 'cert-1password'
    handle_cert_1password
  when 'cert-1password-fields'
    Config.config[:cert_source]['1password-fields'] = JSON.parse(ARGV.shift)
  when 'http-suffix'
    Config.config[:http_suffix] = ARGV.shift
  when 'help-https'
    puts help_https
  else
    Optimist.die "Unknown subcommand: '#{cmd}'"
  end

  save_config
end

#usageObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/heighliner/cmds/set.rb', line 8

def usage
  <<~EOS
    This command lets you set up special variables that configure heighliner'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.
    cert-1password       - Sets up a 1Password item from which HTTPS certificates can be downloaded.
    cert-1password-fields - Sets custom 1Password field names (JSON object)
    help-https           - Shows the HTTPS notes.

    USAGE: heighliner set cert-url
           heighliner set cert-folder
           heighliner set cert-1password
           heighliner set cert-1password-fields
           heighliner set http-suffix
           heighliner set help-https
  EOS
end