bin/mkitd in mkit-0.5.0 vs bin/mkitd in mkit-0.6.0
- old
+ new
@@ -7,41 +7,40 @@
def up
require 'sinatra'
require 'sinatra/base'
require 'mkit'
- # defaults
- PARAMS_CONFIG[:bind] ||= 'localhost'
- PARAMS_CONFIG[:port] ||= 4567
+
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] })
- # MKIt::Server.run
+ # 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. /tmp/app.sock)') { |val| PARAMS_CONFIG[:bind] = val }
- op.on('-s server', 'specify rack server/handler') { |val| PARAMS_CONFIG[:server] = val }
- op.on('-q', 'turn on quiet mode (default is off)') { PARAMS_CONFIG[:quiet] = true }
- op.on('-x', 'turn on the mutex lock (default is off)') { PARAMS_CONFIG[:lock] = true }
- op.on('-e env', 'set the environment (default is development)') do |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('-o addr', "set the host (default is (env == 'development' ? 'localhost' : '0.0.0.0'))") do |val|
- PARAMS_CONFIG[:bind] = val
- 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