##// END OF EJS Templates
svn-support: Add config setting to set the svn proxy (apache) reload command.
Martin Bornhold -
r1005:8241bd32 default
parent child Browse files
Show More
@@ -1,68 +1,69 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import logging
21 import logging
22 import os
22 import os
23
23
24 from rhodecode import events
24 from rhodecode import events
25 from rhodecode.config.middleware import _bool_setting, _string_setting
25 from rhodecode.config.middleware import _bool_setting, _string_setting
26
26
27 from .subscribers import generate_config_subscriber
27 from .subscribers import generate_config_subscriber
28 from . import config_keys
28 from . import config_keys
29
29
30
30
31 log = logging.getLogger(__name__)
31 log = logging.getLogger(__name__)
32
32
33
33
34 def includeme(config):
34 def includeme(config):
35 settings = config.registry.settings
35 settings = config.registry.settings
36 _sanitize_settings_and_apply_defaults(settings)
36 _sanitize_settings_and_apply_defaults(settings)
37
37
38 if settings[config_keys.generate_config]:
38 if settings[config_keys.generate_config]:
39 config.add_subscriber(
39 config.add_subscriber(
40 generate_config_subscriber, events.RepoGroupEvent)
40 generate_config_subscriber, events.RepoGroupEvent)
41
41
42
42
43 def _sanitize_settings_and_apply_defaults(settings):
43 def _sanitize_settings_and_apply_defaults(settings):
44 """
44 """
45 Set defaults, convert to python types and validate settings.
45 Set defaults, convert to python types and validate settings.
46 """
46 """
47 # Convert bool settings from string to bool.
47 # Convert bool settings from string to bool.
48 _bool_setting(settings, config_keys.generate_config, 'false')
48 _bool_setting(settings, config_keys.generate_config, 'false')
49 _bool_setting(settings, config_keys.list_parent_path, 'true')
49 _bool_setting(settings, config_keys.list_parent_path, 'true')
50 _string_setting(settings, config_keys.config_file_path, '', lower=False)
50 _string_setting(settings, config_keys.config_file_path, '', lower=False)
51 _string_setting(settings, config_keys.location_root, '/', lower=False)
51 _string_setting(settings, config_keys.location_root, '/', lower=False)
52 _string_setting(settings, config_keys.reload_command, '', lower=False)
52
53
53 # Append path separator to location root.
54 # Append path separator to location root.
54 settings[config_keys.location_root] = _append_path_sep(
55 settings[config_keys.location_root] = _append_path_sep(
55 settings[config_keys.location_root])
56 settings[config_keys.location_root])
56
57
57 # Validate settings.
58 # Validate settings.
58 if settings[config_keys.generate_config]:
59 if settings[config_keys.generate_config]:
59 assert len(settings[config_keys.config_file_path]) > 0
60 assert len(settings[config_keys.config_file_path]) > 0
60
61
61
62
62 def _append_path_sep(path):
63 def _append_path_sep(path):
63 """
64 """
64 Append the path separator if missing.
65 Append the path separator if missing.
65 """
66 """
66 if isinstance(path, basestring) and not path.endswith(os.path.sep):
67 if isinstance(path, basestring) and not path.endswith(os.path.sep):
67 path += os.path.sep
68 path += os.path.sep
68 return path
69 return path
@@ -1,27 +1,28 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21
21
22 # Definition of setting keys used to configure this module. Defined here to
22 # Definition of setting keys used to configure this module. Defined here to
23 # avoid repetition of keys throughout the module.
23 # avoid repetition of keys throughout the module.
24 config_file_path = 'svn.proxy.config_file_path'
24 config_file_path = 'svn.proxy.config_file_path'
25 generate_config = 'svn.proxy.generate_config'
25 generate_config = 'svn.proxy.generate_config'
26 list_parent_path = 'svn.proxy.list_parent_path'
26 list_parent_path = 'svn.proxy.list_parent_path'
27 location_root = 'svn.proxy.location_root'
27 location_root = 'svn.proxy.location_root'
28 reload_command = 'svn.proxy.reload_cmd'
General Comments 0
You need to be logged in to leave comments. Login now