annotate src/twisted/plugins/libervia_server.py @ 811:b1826adbeeff

server: tls_certificate option: - renamed ssl_certificate to tls_certificate - added a method to handle deprecated options - use C.APP_NAME for config section instead of hardcoded "libervia"
author Goffi <goffi@goffi.org>
date Sun, 20 Dec 2015 19:59:01 +0100
parents 3905bc24eb17
children 6e27604ec95a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 #!/usr/bin/python
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
3
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
4 # Libervia: a Salut à Toi frontend
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
5 # Copyright (C) 2013 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
6
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
7 # This program is free software: you can redistribute it and/or modify
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
10 # (at your option) any later version.
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
11
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
12 # This program is distributed in the hope that it will be useful,
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
15 # GNU Affero General Public License for more details.
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
16
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 331
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
19
437
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
20 from twisted.internet import defer
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
21 if defer.Deferred.debug:
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
22 # if we are in debug mode, we want to use ipdb instead of pdb
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
23 try:
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
24 import ipdb
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
25 import pdb
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
26 pdb.set_trace = ipdb.set_trace
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
27 pdb.post_mortem = ipdb.post_mortem
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
28 except ImportError:
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
29 pass
fa3b65b68971 server side: ipdb is used instead of pdb in debug mode
Goffi <goffi@goffi.org>
parents: 433
diff changeset
30
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
31 import os.path
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
32
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 446
diff changeset
33 from libervia.server.constants import Const as C
470
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
34
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
35 from sat.core.i18n import _
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
36 from sat.tools import config
438
582c435dab6b server side: new log system is used
Goffi <goffi@goffi.org>
parents: 437
diff changeset
37
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
38 from zope.interface import implements
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
39
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
40 from twisted.python import usage
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
41 from twisted.plugin import IPlugin
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
42 from twisted.application.service import IServiceMaker
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
43 import ConfigParser
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
44
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
45
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
46 CONFIG_SECTION = C.APP_NAME.lower()
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
47
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
48
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
49 def coerceConnectionType(value): # called from Libervia.OPT_PARAMETERS
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
50 allowed_values = ('http', 'https', 'both')
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
51 if value not in allowed_values:
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
52 raise ValueError("%(given)s not in %(expected)s" % {'given': value, 'expected': str(allowed_values)})
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
53 return value
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
54
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
55 def coerceDataDir(value): # called from Libervia.OPT_PARAMETERS
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
56 html = os.path.join(value, C.HTML_DIR)
704
5319110a862c server_side: static blog uses the default template
souliane <souliane@mailoo.org>
parents: 570
diff changeset
57 if not os.path.isfile(os.path.join(html, C.LIBERVIA_MAIN_PAGE)):
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
58 raise ValueError("%s is not a Libervia's browser HTML directory" % os.path.realpath(html))
704
5319110a862c server_side: static blog uses the default template
souliane <souliane@mailoo.org>
parents: 570
diff changeset
59 themes_dir = os.path.join(value, C.THEMES_DIR)
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents: 704
diff changeset
60 if not os.path.isfile(os.path.join(themes_dir, 'default/styles/blog.css')):
704
5319110a862c server_side: static blog uses the default template
souliane <souliane@mailoo.org>
parents: 570
diff changeset
61 raise ValueError("%s is not a Libervia's server data directory" % os.path.realpath(themes_dir))
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
62 return value
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
63
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
64 DATA_DIR_DEFAULT = ''
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
65 OPT_PARAMETERS_BOTH = [['connection_type', 't', 'https', _(u"'http', 'https' or 'both' (to launch both servers).").encode('utf-8'), coerceConnectionType],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
66 ['port', 'p', 8080, _(u'The port number to listen HTTP on.').encode('utf-8'), int],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
67 ['port_https', 's', 8443, _(u'The port number to listen HTTPS on.').encode('utf-8'), int],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
68 ['port_https_ext', 'e', 0, _(u'The external port number used for HTTPS (0 means port_https value).').encode('utf-8'), int],
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
69 ['tls_certificate', 'c', 'libervia.pem', _(u'TLS certificate public certificate or private key and public certificate combined (PEM format)').encode('utf-8'), str],
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
70 ['redirect_to_https', 'r', 1, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), int],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
71 ['security_warning', 'w', 1, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), int],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
72 ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
73 ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir],
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
74 ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
75 OPT_PARAMETERS_CFG = [['empty_password_allowed_warning_dangerous_list', None, '', None]] # Options which are in sat.conf only
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
76
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
77 def initialise(options):
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
78 """Method to initialise global modules"""
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
79 from twisted.internet import glib2reactor
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
80 glib2reactor.install()
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
81 # XXX: We need to configure logs before any log method is used, so here is the best place.
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
82 from sat.core import log_config
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
83 log_config.satConfigure(C.LOG_BACKEND_TWISTED, C, backend_data=options)
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
84 from libervia.server import server
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
85 # we can't import this file from libervia.server.server because it's not a true module
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
86 # (there is no __init__.py file, as required by twistd plugin system), so we set the
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
87 # global values from here
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
88 server.DATA_DIR_DEFAULT = DATA_DIR_DEFAULT
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
89 server.OPT_PARAMETERS_BOTH = OPT_PARAMETERS_BOTH
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
90 server.OPT_PARAMETERS_CFG = OPT_PARAMETERS_CFG
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
91 server.coerceDataDir = coerceDataDir
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
92
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
93
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
94 class Options(usage.Options):
415
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
95 # optArgs is not really useful in our case, we need more than a flag
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
96 optParameters = OPT_PARAMETERS_BOTH
415
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
97
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
98 def __init__(self):
470
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
99 """Read SàT configuration file in order to overwrite the hard-coded default values.
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
100
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
101 Priority for the usage of the values is (from lowest to highest):
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
102 - hard-coded default values
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
103 - values from SàT configuration files
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
104 - values passed on the command line
415
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
105 """
470
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
106 # If we do it the reading later: after the command line options have been parsed, there's no good way to know
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
107 # if the options values are the hard-coded ones or if they have been passed on the command line.
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
108
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
109 # FIXME: must be refactored + code can be factorised with backend
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
110 config_parser = ConfigParser.SafeConfigParser()
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
111 config_parser.read(C.CONFIG_FILES)
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
112 self.handleDeprecated(config_parser)
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
113 for param in self.optParameters + OPT_PARAMETERS_CFG:
432
8ecc5a7062e4 browser and server sides: fixes module import + use enumerate instead of xrange
souliane <souliane@mailoo.org>
parents: 421
diff changeset
114 name = param[0]
415
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
115 try:
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
116 value = config.getConfig(config_parser, CONFIG_SECTION, name, Exception)
470
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
117 try:
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
118 param[2] = param[4](value)
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
119 except IndexError: # the coerce method is optional
34ce41e014c4 server side: options managing improvments:
Goffi <goffi@goffi.org>
parents: 466
diff changeset
120 param[2] = value
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
121 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
415
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
122 pass
fadbba1d793f server_side: added support for SSL and related parameters:
souliane <souliane@mailoo.org>
parents: 360
diff changeset
123 usage.Options.__init__(self)
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
124
811
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
125 def handleDeprecated(self, config_parser):
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
126 """display warning and/or change option when a deprecated option if found
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
127
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
128 param config_parser(ConfigParser): read ConfigParser instance for sat.conf
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
129 """
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
130 replacements = (('ssl_certificate', 'tls_certificate'),)
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
131 for old, new in replacements:
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
132 try:
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
133 value = config.getConfig(config_parser, CONFIG_SECTION, old, Exception)
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
134 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
135 pass
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
136 else:
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
137 print u"\n/!\\ Use of {old} is deprecated, please use {new} instead\n".format(old=old, new=new)
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
138 config_parser.set(CONFIG_SECTION, new, value)
b1826adbeeff server: tls_certificate option:
Goffi <goffi@goffi.org>
parents: 810
diff changeset
139
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
140
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
141 class LiberviaMaker(object):
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
142 implements(IServiceMaker, IPlugin)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 446
diff changeset
143
512
750db9ff8525 server side: launching script improvments:
Goffi <goffi@goffi.org>
parents: 474
diff changeset
144 tapname = C.APP_NAME_FILE
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
145 description = _(u'The web frontend of Salut à Toi')
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
146 options = Options
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
147
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
148 def makeService(self, options):
514
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
149 initialise(options.parent)
530c88c1deee server_side: plugin refactoring:
Goffi <goffi@goffi.org>
parents: 512
diff changeset
150 from libervia.server import server
810
3905bc24eb17 server: proper options handling
Goffi <goffi@goffi.org>
parents: 712
diff changeset
151 return server.Libervia(options)
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
152
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
153
421
39b07289ff42 server_side: added parameter port_https_ext (external port for HTTPS, used for example for the redirection)
souliane <souliane@mailoo.org>
parents: 417
diff changeset
154 # affectation to some variable is necessary for twisted introspection to work
331
06a48d805547 server side: make Libervia a Twisted plugin, and add it the --port argument + add a config file for the port.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
155 serviceMaker = LiberviaMaker()