lib/trinidad/server.rb in trinidad-0.9.3 vs lib/trinidad/server.rb in trinidad-0.9.4
- old
+ new
@@ -91,14 +91,14 @@
options[:keystoreFile] ||= options.delete(:keystore)
if !options[:keystoreFile] && !options[:SSLCertificateFile]
options[:keystoreFile] = 'ssl/keystore'
options[:keystorePass] = 'waduswadus'
+ create_default_keystore(options)
end
add_service_connector(options)
- create_default_keystore(options)
end
def add_http_connector
options = @config[:http]
options[:port] = @config[:port]
@@ -119,15 +119,12 @@
def http_configured?
@config.has_key?(:http)
end
def create_default_keystore(config)
- keystore_file_path = config[:keystoreFile]
- return unless keystore_file_path && File.exist?(keystore_file_path)
+ keystore_file = java.io.File.new(config[:keystoreFile])
- keystore_file = java.io.File.new(keystore_file)
-
if (!keystore_file.parent_file.exists &&
!keystore_file.parent_file.mkdir)
raise "Unable to create keystore folder: " + keystore_file.parent_file.canonical_path
end
@@ -135,10 +132,10 @@
"-alias", "localhost",
"-dname", "CN=localhost, OU=Trinidad, O=Trinidad, C=ES",
"-keyalg", "RSA",
"-validity", "365",
"-storepass", "key",
- "-keystore", keystore_file_path,
+ "-keystore", config[:keystoreFile],
"-storepass", config[:keystorePass],
"-keypass", config[:keystorePass]]
Trinidad::Tomcat::KeyTool.main(keytool_args.to_java(:string))
end