Mercurial > libervia-web
comparison src/twisted/plugins/libervia_server.py @ 870:a05f3b24f2ec
server: use C.bool for bool options instead of simple int
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 29 Feb 2016 12:37:58 +0100 |
parents | 20fbca3c949a |
children | 54f6c5b86a87 |
comparison
equal
deleted
inserted
replaced
869:fa7703642c0e | 870:a05f3b24f2ec |
---|---|
91 themes_dir = os.path.join(value, C.THEMES_DIR) | 91 themes_dir = os.path.join(value, C.THEMES_DIR) |
92 if not os.path.isfile(os.path.join(themes_dir, 'default/styles/blog.css')): | 92 if not os.path.isfile(os.path.join(themes_dir, 'default/styles/blog.css')): |
93 raise ValueError("%s is not a Libervia's server data directory" % os.path.realpath(themes_dir)) | 93 raise ValueError("%s is not a Libervia's server data directory" % os.path.realpath(themes_dir)) |
94 return value | 94 return value |
95 | 95 |
96 def coerceBool(value): | |
97 return C.bool(value) | |
98 | |
96 DATA_DIR_DEFAULT = '' | 99 DATA_DIR_DEFAULT = '' |
97 OPT_PARAMETERS_BOTH = [['connection_type', 't', 'https', _(u"'http', 'https' or 'both' (to launch both servers).").encode('utf-8'), coerceConnectionType], | 100 OPT_PARAMETERS_BOTH = [['connection_type', 't', 'https', _(u"'http', 'https' or 'both' (to launch both servers).").encode('utf-8'), coerceConnectionType], |
98 ['port', 'p', 8080, _(u'The port number to listen HTTP on.').encode('utf-8'), int], | 101 ['port', 'p', 8080, _(u'The port number to listen HTTP on.').encode('utf-8'), int], |
99 ['port_https', 's', 8443, _(u'The port number to listen HTTPS on.').encode('utf-8'), int], | 102 ['port_https', 's', 8443, _(u'The port number to listen HTTPS on.').encode('utf-8'), int], |
100 ['port_https_ext', 'e', 0, _(u'The external port number used for HTTPS (0 means port_https value).').encode('utf-8'), int], | 103 ['port_https_ext', 'e', 0, _(u'The external port number used for HTTPS (0 means port_https value).').encode('utf-8'), int], |
101 ['tls_private_key', '', '', _(u'TLS certificate private key (PEM format)').encode('utf-8'), str], | 104 ['tls_private_key', '', '', _(u'TLS certificate private key (PEM format)').encode('utf-8'), str], |
102 ['tls_certificate', 'c', 'libervia.pem', _(u'TLS public certificate or private key and public certificate combined (PEM format)').encode('utf-8'), str], | 105 ['tls_certificate', 'c', 'libervia.pem', _(u'TLS public certificate or private key and public certificate combined (PEM format)').encode('utf-8'), str], |
103 ['tls_chain', '', '', _(u'TLS certificate intermediate chain (PEM format)').encode('utf-8'), str], | 106 ['tls_chain', '', '', _(u'TLS certificate intermediate chain (PEM format)').encode('utf-8'), str], |
104 ['redirect_to_https', 'r', 1, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), int], | 107 ['redirect_to_https', 'r', True, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), coerceBool], |
105 ['security_warning', 'w', 1, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), int], | 108 ['security_warning', 'w', True, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), coerceBool], |
106 ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str], | 109 ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str], |
107 ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir], | 110 ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir], |
108 ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html | 111 ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html |
109 # Options which are in sat.conf only | 112 # Options which are in sat.conf only |
110 OPT_PARAMETERS_CFG = [ | 113 OPT_PARAMETERS_CFG = [ |