Class: Identizer::CLI
- Inherits:
-
Object
- Object
- Identizer::CLI
- Defined in:
- lib/identizer/cli.rb
Overview
‘identizer` command: configure from flags/env and boot the standalone server.
Constant Summary collapse
- DEMO_USER =
Seeded on first run so the directory isn’t empty and login works immediately.
{ mail: "demo@example.com", givenName: "Demo", sn: "User" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#configure(config = Identizer.configuration) ⇒ Object
Parse the flags onto a configuration and apply any saved settings, without starting the server.
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
15 16 17 18 |
# File 'lib/identizer/cli.rb', line 15 def initialize(argv) @argv = argv @demo = true end |
Class Method Details
.start(argv) ⇒ Object
11 12 13 |
# File 'lib/identizer/cli.rb', line 11 def self.start(argv) new(argv).run end |
Instance Method Details
#configure(config = Identizer.configuration) ⇒ Object
Parse the flags onto a configuration and apply any saved settings, without starting the server. Separated out so it can be exercised in tests.
28 29 30 31 32 33 34 |
# File 'lib/identizer/cli.rb', line 28 def configure(config = Identizer.configuration) parser(config).parse!(@argv) config.apply_persisted_settings! # web-admin saved password/signing config.seed_identities = [DEMO_USER] if @demo && config.seed_identities.empty? load_sqlite(config) if config.sqlite_path config end |
#run ⇒ Object
20 21 22 23 24 |
# File 'lib/identizer/cli.rb', line 20 def run config = configure(Identizer.configuration) start_ldap(config) Server.start(config) end |