Sha256: 436729507589ed8fb8a8f357e207755bd3d041d06bbd2d055a8234a2df5a2bfc
Contents?: true
Size: 1.66 KB
Versions: 9
Compression:
Stored size: 1.66 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'rubygems' PARAMS_CONFIG = {} def up require 'sinatra' require 'sinatra/base' require 'mkit' MKIt.startup(options: PARAMS_CONFIG) use Rack::MethodOverride use ServicesController use MkitJobsController use MkitController # sinatra::base ignores in parameters # set it here or via configure... # Sinatra::Application.run!({ port: PARAMS_CONFIG[:port], bind: PARAMS_CONFIG[:bind] }) Sinatra::Application.run! do |server| MKIt.options(server) end end if ARGV.any? require 'optparse' parser = OptionParser.new do |op| op.on('-c config-dir', 'set the config dir (default is /etc/mkit)') { |val| PARAMS_CONFIG[:config_dir] = val } op.on('-p port', 'set the port (default is 4567)') { |val| PARAMS_CONFIG[:port] = Integer(val) } op.on('-b bind', 'specify bind address (e.g. 0.0.0.0)') { |val| PARAMS_CONFIG[:bind] = val } op.on('-o addr', 'alias for bind option') { |val| PARAMS_CONFIG[:bind] = val } op.on('-e env', 'set the environment (default is development)') do |val| ENV['RACK_ENV'] = val PARAMS_CONFIG[:environment] = val.to_sym end op.on('--no-ssl', 'disable ssl - use http for local server. (default is https)') { PARAMS_CONFIG[:ssl] = false } op.on('--ssl-key-file PATH', 'Path to private key (default mkit internal)') { |val| PARAMS_CONFIG[:private_key_file] = val } op.on('--ssl-cert-file PATH', 'Path to certificate (default mkit internal)') { |val| PARAMS_CONFIG[:cert_chain_file] = val } end begin parser.parse!(ARGV.dup) rescue StandardError => e PARAMS_CONFIG[:optparse_error] = e end end up
Version data entries
9 entries across 9 versions & 1 rubygems