Show More
@@ -1,295 +1,295 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | # This program is free software: you can redistribute it and/or modify |
|
2 | # This program is free software: you can redistribute it and/or modify | |
3 | # it under the terms of the GNU General Public License as published by |
|
3 | # it under the terms of the GNU General Public License as published by | |
4 | # the Free Software Foundation, either version 3 of the License, or |
|
4 | # the Free Software Foundation, either version 3 of the License, or | |
5 | # (at your option) any later version. |
|
5 | # (at your option) any later version. | |
6 | # |
|
6 | # | |
7 | # This program is distributed in the hope that it will be useful, |
|
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | # GNU General Public License for more details. |
|
10 | # GNU General Public License for more details. | |
11 | # |
|
11 | # | |
12 | # You should have received a copy of the GNU General Public License |
|
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 |
|
14 | |||
15 | """ |
|
15 | """ | |
16 | Helpers for fixture generation |
|
16 | Helpers for fixture generation | |
17 | """ |
|
17 | """ | |
18 | import os |
|
18 | import os | |
19 | import time |
|
19 | import time | |
20 | from kallithea.tests import * |
|
20 | from kallithea.tests import * | |
21 | from kallithea.model.db import Repository, User, RepoGroup, UserGroup |
|
21 | from kallithea.model.db import Repository, User, RepoGroup, UserGroup | |
22 | from kallithea.model.meta import Session |
|
22 | from kallithea.model.meta import Session | |
23 | from kallithea.model.repo import RepoModel |
|
23 | from kallithea.model.repo import RepoModel | |
24 | from kallithea.model.user import UserModel |
|
24 | from kallithea.model.user import UserModel | |
25 | from kallithea.model.repo_group import RepoGroupModel |
|
25 | from kallithea.model.repo_group import RepoGroupModel | |
26 | from kallithea.model.user_group import UserGroupModel |
|
26 | from kallithea.model.user_group import UserGroupModel | |
27 | from kallithea.model.gist import GistModel |
|
27 | from kallithea.model.gist import GistModel | |
28 | from kallithea.model.scm import ScmModel |
|
28 | from kallithea.model.scm import ScmModel | |
29 | from kallithea.lib.vcs.backends.base import EmptyChangeset |
|
29 | from kallithea.lib.vcs.backends.base import EmptyChangeset | |
30 |
|
30 | |||
31 | dn = os.path.dirname |
|
31 | dn = os.path.dirname | |
32 | FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'tests', 'fixtures') |
|
32 | FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'tests', 'fixtures') | |
33 |
|
33 | |||
34 |
|
34 | |||
35 | def error_function(*args, **kwargs): |
|
35 | def error_function(*args, **kwargs): | |
36 | raise Exception('Total Crash !') |
|
36 | raise Exception('Total Crash !') | |
37 |
|
37 | |||
38 |
|
38 | |||
39 | class Fixture(object): |
|
39 | class Fixture(object): | |
40 |
|
40 | |||
41 | def __init__(self): |
|
41 | def __init__(self): | |
42 | pass |
|
42 | pass | |
43 |
|
43 | |||
44 | def anon_access(self, status): |
|
44 | def anon_access(self, status): | |
45 | """ |
|
45 | """ | |
46 | Context process for disabling anonymous access. use like: |
|
46 | Context process for disabling anonymous access. use like: | |
47 | fixture = Fixture() |
|
47 | fixture = Fixture() | |
48 | with fixture.anon_access(False): |
|
48 | with fixture.anon_access(False): | |
49 | #tests |
|
49 | #tests | |
50 |
|
50 | |||
51 | after this block anon access will be set to `not status` |
|
51 | after this block anon access will be set to `not status` | |
52 | """ |
|
52 | """ | |
53 |
|
53 | |||
54 | class context(object): |
|
54 | class context(object): | |
55 | def __enter__(self): |
|
55 | def __enter__(self): | |
56 | anon = User.get_default_user() |
|
56 | anon = User.get_default_user() | |
57 | anon.active = status |
|
57 | anon.active = status | |
58 | Session().add(anon) |
|
58 | Session().add(anon) | |
59 | Session().commit() |
|
59 | Session().commit() | |
60 |
time.sleep(1.5) # |
|
60 | time.sleep(1.5) # hack: wait for beaker sql_cache_short to expire | |
61 |
|
61 | |||
62 | def __exit__(self, exc_type, exc_val, exc_tb): |
|
62 | def __exit__(self, exc_type, exc_val, exc_tb): | |
63 | anon = User.get_default_user() |
|
63 | anon = User.get_default_user() | |
64 | anon.active = not status |
|
64 | anon.active = not status | |
65 | Session().add(anon) |
|
65 | Session().add(anon) | |
66 | Session().commit() |
|
66 | Session().commit() | |
67 |
|
67 | |||
68 | return context() |
|
68 | return context() | |
69 |
|
69 | |||
70 | def _get_repo_create_params(self, **custom): |
|
70 | def _get_repo_create_params(self, **custom): | |
71 | defs = dict( |
|
71 | defs = dict( | |
72 | repo_name=None, |
|
72 | repo_name=None, | |
73 | repo_type='hg', |
|
73 | repo_type='hg', | |
74 | clone_uri='', |
|
74 | clone_uri='', | |
75 | repo_group='-1', |
|
75 | repo_group='-1', | |
76 | repo_description='DESC', |
|
76 | repo_description='DESC', | |
77 | repo_private=False, |
|
77 | repo_private=False, | |
78 | repo_landing_rev='rev:tip', |
|
78 | repo_landing_rev='rev:tip', | |
79 | repo_copy_permissions=False, |
|
79 | repo_copy_permissions=False, | |
80 | repo_state=Repository.STATE_CREATED, |
|
80 | repo_state=Repository.STATE_CREATED, | |
81 | ) |
|
81 | ) | |
82 | defs.update(custom) |
|
82 | defs.update(custom) | |
83 | if 'repo_name_full' not in custom: |
|
83 | if 'repo_name_full' not in custom: | |
84 | defs.update({'repo_name_full': defs['repo_name']}) |
|
84 | defs.update({'repo_name_full': defs['repo_name']}) | |
85 |
|
85 | |||
86 | # fix the repo name if passed as repo_name_full |
|
86 | # fix the repo name if passed as repo_name_full | |
87 | if defs['repo_name']: |
|
87 | if defs['repo_name']: | |
88 | defs['repo_name'] = defs['repo_name'].split('/')[-1] |
|
88 | defs['repo_name'] = defs['repo_name'].split('/')[-1] | |
89 |
|
89 | |||
90 | return defs |
|
90 | return defs | |
91 |
|
91 | |||
92 | def _get_group_create_params(self, **custom): |
|
92 | def _get_group_create_params(self, **custom): | |
93 | defs = dict( |
|
93 | defs = dict( | |
94 | group_name=None, |
|
94 | group_name=None, | |
95 | group_description='DESC', |
|
95 | group_description='DESC', | |
96 | group_parent_id=None, |
|
96 | group_parent_id=None, | |
97 | perms_updates=[], |
|
97 | perms_updates=[], | |
98 | perms_new=[], |
|
98 | perms_new=[], | |
99 | enable_locking=False, |
|
99 | enable_locking=False, | |
100 | recursive=False |
|
100 | recursive=False | |
101 | ) |
|
101 | ) | |
102 | defs.update(custom) |
|
102 | defs.update(custom) | |
103 |
|
103 | |||
104 | return defs |
|
104 | return defs | |
105 |
|
105 | |||
106 | def _get_user_create_params(self, name, **custom): |
|
106 | def _get_user_create_params(self, name, **custom): | |
107 | defs = dict( |
|
107 | defs = dict( | |
108 | username=name, |
|
108 | username=name, | |
109 | password='qweqwe', |
|
109 | password='qweqwe', | |
110 | email='%s+test@example.com' % name, |
|
110 | email='%s+test@example.com' % name, | |
111 | firstname='TestUser', |
|
111 | firstname='TestUser', | |
112 | lastname='Test', |
|
112 | lastname='Test', | |
113 | active=True, |
|
113 | active=True, | |
114 | admin=False, |
|
114 | admin=False, | |
115 | extern_type='internal', |
|
115 | extern_type='internal', | |
116 | extern_name=None |
|
116 | extern_name=None | |
117 | ) |
|
117 | ) | |
118 | defs.update(custom) |
|
118 | defs.update(custom) | |
119 |
|
119 | |||
120 | return defs |
|
120 | return defs | |
121 |
|
121 | |||
122 | def _get_user_group_create_params(self, name, **custom): |
|
122 | def _get_user_group_create_params(self, name, **custom): | |
123 | defs = dict( |
|
123 | defs = dict( | |
124 | users_group_name=name, |
|
124 | users_group_name=name, | |
125 | user_group_description='DESC', |
|
125 | user_group_description='DESC', | |
126 | users_group_active=True, |
|
126 | users_group_active=True, | |
127 | user_group_data={}, |
|
127 | user_group_data={}, | |
128 | ) |
|
128 | ) | |
129 | defs.update(custom) |
|
129 | defs.update(custom) | |
130 |
|
130 | |||
131 | return defs |
|
131 | return defs | |
132 |
|
132 | |||
133 | def create_repo(self, name, **kwargs): |
|
133 | def create_repo(self, name, **kwargs): | |
134 | if 'skip_if_exists' in kwargs: |
|
134 | if 'skip_if_exists' in kwargs: | |
135 | del kwargs['skip_if_exists'] |
|
135 | del kwargs['skip_if_exists'] | |
136 | r = Repository.get_by_repo_name(name) |
|
136 | r = Repository.get_by_repo_name(name) | |
137 | if r: |
|
137 | if r: | |
138 | return r |
|
138 | return r | |
139 |
|
139 | |||
140 | if isinstance(kwargs.get('repo_group'), RepoGroup): |
|
140 | if isinstance(kwargs.get('repo_group'), RepoGroup): | |
141 | kwargs['repo_group'] = kwargs['repo_group'].group_id |
|
141 | kwargs['repo_group'] = kwargs['repo_group'].group_id | |
142 |
|
142 | |||
143 | form_data = self._get_repo_create_params(repo_name=name, **kwargs) |
|
143 | form_data = self._get_repo_create_params(repo_name=name, **kwargs) | |
144 | cur_user = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) |
|
144 | cur_user = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) | |
145 | RepoModel().create(form_data, cur_user) |
|
145 | RepoModel().create(form_data, cur_user) | |
146 | Session().commit() |
|
146 | Session().commit() | |
147 | return Repository.get_by_repo_name(name) |
|
147 | return Repository.get_by_repo_name(name) | |
148 |
|
148 | |||
149 | def create_fork(self, repo_to_fork, fork_name, **kwargs): |
|
149 | def create_fork(self, repo_to_fork, fork_name, **kwargs): | |
150 | repo_to_fork = Repository.get_by_repo_name(repo_to_fork) |
|
150 | repo_to_fork = Repository.get_by_repo_name(repo_to_fork) | |
151 |
|
151 | |||
152 | form_data = self._get_repo_create_params(repo_name=fork_name, |
|
152 | form_data = self._get_repo_create_params(repo_name=fork_name, | |
153 | fork_parent_id=repo_to_fork, |
|
153 | fork_parent_id=repo_to_fork, | |
154 | repo_type=repo_to_fork.repo_type, |
|
154 | repo_type=repo_to_fork.repo_type, | |
155 | **kwargs) |
|
155 | **kwargs) | |
156 | form_data['update_after_clone'] = False |
|
156 | form_data['update_after_clone'] = False | |
157 |
|
157 | |||
158 | #TODO: fix it !! |
|
158 | #TODO: fix it !! | |
159 | form_data['description'] = form_data['repo_description'] |
|
159 | form_data['description'] = form_data['repo_description'] | |
160 | form_data['private'] = form_data['repo_private'] |
|
160 | form_data['private'] = form_data['repo_private'] | |
161 | form_data['landing_rev'] = form_data['repo_landing_rev'] |
|
161 | form_data['landing_rev'] = form_data['repo_landing_rev'] | |
162 |
|
162 | |||
163 | owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) |
|
163 | owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) | |
164 | RepoModel().create_fork(form_data, cur_user=owner) |
|
164 | RepoModel().create_fork(form_data, cur_user=owner) | |
165 | Session().commit() |
|
165 | Session().commit() | |
166 | r = Repository.get_by_repo_name(fork_name) |
|
166 | r = Repository.get_by_repo_name(fork_name) | |
167 | assert r |
|
167 | assert r | |
168 | return r |
|
168 | return r | |
169 |
|
169 | |||
170 | def destroy_repo(self, repo_name, **kwargs): |
|
170 | def destroy_repo(self, repo_name, **kwargs): | |
171 | RepoModel().delete(repo_name, **kwargs) |
|
171 | RepoModel().delete(repo_name, **kwargs) | |
172 | Session().commit() |
|
172 | Session().commit() | |
173 |
|
173 | |||
174 | def create_repo_group(self, name, **kwargs): |
|
174 | def create_repo_group(self, name, **kwargs): | |
175 | if 'skip_if_exists' in kwargs: |
|
175 | if 'skip_if_exists' in kwargs: | |
176 | del kwargs['skip_if_exists'] |
|
176 | del kwargs['skip_if_exists'] | |
177 | gr = RepoGroup.get_by_group_name(group_name=name) |
|
177 | gr = RepoGroup.get_by_group_name(group_name=name) | |
178 | if gr: |
|
178 | if gr: | |
179 | return gr |
|
179 | return gr | |
180 | form_data = self._get_group_create_params(group_name=name, **kwargs) |
|
180 | form_data = self._get_group_create_params(group_name=name, **kwargs) | |
181 | owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) |
|
181 | owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) | |
182 | gr = RepoGroupModel().create( |
|
182 | gr = RepoGroupModel().create( | |
183 | group_name=form_data['group_name'], |
|
183 | group_name=form_data['group_name'], | |
184 | group_description=form_data['group_name'], |
|
184 | group_description=form_data['group_name'], | |
185 | owner=owner, parent=form_data['group_parent_id']) |
|
185 | owner=owner, parent=form_data['group_parent_id']) | |
186 | Session().commit() |
|
186 | Session().commit() | |
187 | gr = RepoGroup.get_by_group_name(gr.group_name) |
|
187 | gr = RepoGroup.get_by_group_name(gr.group_name) | |
188 | return gr |
|
188 | return gr | |
189 |
|
189 | |||
190 | def destroy_repo_group(self, repogroupid): |
|
190 | def destroy_repo_group(self, repogroupid): | |
191 | RepoGroupModel().delete(repogroupid) |
|
191 | RepoGroupModel().delete(repogroupid) | |
192 | Session().commit() |
|
192 | Session().commit() | |
193 |
|
193 | |||
194 | def create_user(self, name, **kwargs): |
|
194 | def create_user(self, name, **kwargs): | |
195 | if 'skip_if_exists' in kwargs: |
|
195 | if 'skip_if_exists' in kwargs: | |
196 | del kwargs['skip_if_exists'] |
|
196 | del kwargs['skip_if_exists'] | |
197 | user = User.get_by_username(name) |
|
197 | user = User.get_by_username(name) | |
198 | if user: |
|
198 | if user: | |
199 | return user |
|
199 | return user | |
200 | form_data = self._get_user_create_params(name, **kwargs) |
|
200 | form_data = self._get_user_create_params(name, **kwargs) | |
201 | user = UserModel().create(form_data) |
|
201 | user = UserModel().create(form_data) | |
202 | Session().commit() |
|
202 | Session().commit() | |
203 | user = User.get_by_username(user.username) |
|
203 | user = User.get_by_username(user.username) | |
204 | return user |
|
204 | return user | |
205 |
|
205 | |||
206 | def destroy_user(self, userid): |
|
206 | def destroy_user(self, userid): | |
207 | UserModel().delete(userid) |
|
207 | UserModel().delete(userid) | |
208 | Session().commit() |
|
208 | Session().commit() | |
209 |
|
209 | |||
210 | def create_user_group(self, name, **kwargs): |
|
210 | def create_user_group(self, name, **kwargs): | |
211 | if 'skip_if_exists' in kwargs: |
|
211 | if 'skip_if_exists' in kwargs: | |
212 | del kwargs['skip_if_exists'] |
|
212 | del kwargs['skip_if_exists'] | |
213 | gr = UserGroup.get_by_group_name(group_name=name) |
|
213 | gr = UserGroup.get_by_group_name(group_name=name) | |
214 | if gr: |
|
214 | if gr: | |
215 | return gr |
|
215 | return gr | |
216 | form_data = self._get_user_group_create_params(name, **kwargs) |
|
216 | form_data = self._get_user_group_create_params(name, **kwargs) | |
217 | owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) |
|
217 | owner = kwargs.get('cur_user', TEST_USER_ADMIN_LOGIN) | |
218 | user_group = UserGroupModel().create( |
|
218 | user_group = UserGroupModel().create( | |
219 | name=form_data['users_group_name'], |
|
219 | name=form_data['users_group_name'], | |
220 | description=form_data['user_group_description'], |
|
220 | description=form_data['user_group_description'], | |
221 | owner=owner, active=form_data['users_group_active'], |
|
221 | owner=owner, active=form_data['users_group_active'], | |
222 | group_data=form_data['user_group_data']) |
|
222 | group_data=form_data['user_group_data']) | |
223 | Session().commit() |
|
223 | Session().commit() | |
224 | user_group = UserGroup.get_by_group_name(user_group.users_group_name) |
|
224 | user_group = UserGroup.get_by_group_name(user_group.users_group_name) | |
225 | return user_group |
|
225 | return user_group | |
226 |
|
226 | |||
227 | def destroy_user_group(self, usergroupid): |
|
227 | def destroy_user_group(self, usergroupid): | |
228 | UserGroupModel().delete(user_group=usergroupid, force=True) |
|
228 | UserGroupModel().delete(user_group=usergroupid, force=True) | |
229 | Session().commit() |
|
229 | Session().commit() | |
230 |
|
230 | |||
231 | def create_gist(self, **kwargs): |
|
231 | def create_gist(self, **kwargs): | |
232 | form_data = { |
|
232 | form_data = { | |
233 | 'description': u'new-gist', |
|
233 | 'description': u'new-gist', | |
234 | 'owner': TEST_USER_ADMIN_LOGIN, |
|
234 | 'owner': TEST_USER_ADMIN_LOGIN, | |
235 | 'gist_type': GistModel.cls.GIST_PUBLIC, |
|
235 | 'gist_type': GistModel.cls.GIST_PUBLIC, | |
236 | 'lifetime': -1, |
|
236 | 'lifetime': -1, | |
237 | 'gist_mapping': {'filename1.txt':{'content':'hello world'},} |
|
237 | 'gist_mapping': {'filename1.txt':{'content':'hello world'},} | |
238 | } |
|
238 | } | |
239 | form_data.update(kwargs) |
|
239 | form_data.update(kwargs) | |
240 | gist = GistModel().create( |
|
240 | gist = GistModel().create( | |
241 | description=form_data['description'],owner=form_data['owner'], |
|
241 | description=form_data['description'],owner=form_data['owner'], | |
242 | gist_mapping=form_data['gist_mapping'], gist_type=form_data['gist_type'], |
|
242 | gist_mapping=form_data['gist_mapping'], gist_type=form_data['gist_type'], | |
243 | lifetime=form_data['lifetime'] |
|
243 | lifetime=form_data['lifetime'] | |
244 | ) |
|
244 | ) | |
245 | Session().commit() |
|
245 | Session().commit() | |
246 |
|
246 | |||
247 | return gist |
|
247 | return gist | |
248 |
|
248 | |||
249 | def destroy_gists(self, gistid=None): |
|
249 | def destroy_gists(self, gistid=None): | |
250 | for g in GistModel.cls.get_all(): |
|
250 | for g in GistModel.cls.get_all(): | |
251 | if gistid: |
|
251 | if gistid: | |
252 | if gistid == g.gist_access_id: |
|
252 | if gistid == g.gist_access_id: | |
253 | GistModel().delete(g) |
|
253 | GistModel().delete(g) | |
254 | else: |
|
254 | else: | |
255 | GistModel().delete(g) |
|
255 | GistModel().delete(g) | |
256 | Session().commit() |
|
256 | Session().commit() | |
257 |
|
257 | |||
258 | def load_resource(self, resource_name, strip=True): |
|
258 | def load_resource(self, resource_name, strip=True): | |
259 | with open(os.path.join(FIXTURES, resource_name)) as f: |
|
259 | with open(os.path.join(FIXTURES, resource_name)) as f: | |
260 | source = f.read() |
|
260 | source = f.read() | |
261 | if strip: |
|
261 | if strip: | |
262 | source = source.strip() |
|
262 | source = source.strip() | |
263 |
|
263 | |||
264 | return source |
|
264 | return source | |
265 |
|
265 | |||
266 | def commit_change(self, repo, filename, content, message, vcs_type, parent=None, newfile=False): |
|
266 | def commit_change(self, repo, filename, content, message, vcs_type, parent=None, newfile=False): | |
267 | repo = Repository.get_by_repo_name(repo) |
|
267 | repo = Repository.get_by_repo_name(repo) | |
268 | _cs = parent |
|
268 | _cs = parent | |
269 | if not parent: |
|
269 | if not parent: | |
270 | _cs = EmptyChangeset(alias=vcs_type) |
|
270 | _cs = EmptyChangeset(alias=vcs_type) | |
271 |
|
271 | |||
272 | if newfile: |
|
272 | if newfile: | |
273 | nodes = { |
|
273 | nodes = { | |
274 | filename: { |
|
274 | filename: { | |
275 | 'content': content |
|
275 | 'content': content | |
276 | } |
|
276 | } | |
277 | } |
|
277 | } | |
278 | cs = ScmModel().create_nodes( |
|
278 | cs = ScmModel().create_nodes( | |
279 | user=TEST_USER_ADMIN_LOGIN, repo=repo, |
|
279 | user=TEST_USER_ADMIN_LOGIN, repo=repo, | |
280 | message=message, |
|
280 | message=message, | |
281 | nodes=nodes, |
|
281 | nodes=nodes, | |
282 | parent_cs=_cs, |
|
282 | parent_cs=_cs, | |
283 | author=TEST_USER_ADMIN_LOGIN, |
|
283 | author=TEST_USER_ADMIN_LOGIN, | |
284 | ) |
|
284 | ) | |
285 | else: |
|
285 | else: | |
286 | cs = ScmModel().commit_change( |
|
286 | cs = ScmModel().commit_change( | |
287 | repo=repo.scm_instance, repo_name=repo.repo_name, |
|
287 | repo=repo.scm_instance, repo_name=repo.repo_name, | |
288 | cs=parent, user=TEST_USER_ADMIN_LOGIN, |
|
288 | cs=parent, user=TEST_USER_ADMIN_LOGIN, | |
289 | author=TEST_USER_ADMIN_LOGIN, |
|
289 | author=TEST_USER_ADMIN_LOGIN, | |
290 | message=message, |
|
290 | message=message, | |
291 | content=content, |
|
291 | content=content, | |
292 | f_path=filename |
|
292 | f_path=filename | |
293 | ) |
|
293 | ) | |
294 | return cs |
|
294 | return cs | |
295 |
|
295 |
@@ -1,587 +1,587 b'' | |||||
1 | ################################################################################ |
|
1 | ################################################################################ | |
2 | ################################################################################ |
|
2 | ################################################################################ | |
3 | # Kallithea - config for tests: # |
|
3 | # Kallithea - config for tests: # | |
4 | # initial_repo_scan = true # |
|
4 | # initial_repo_scan = true # | |
5 | # vcs_full_cache = false # |
|
5 | # vcs_full_cache = false # | |
6 | # sqlalchemy and kallithea_test.sqlite # |
|
6 | # sqlalchemy and kallithea_test.sqlite # | |
7 | # custom logging # |
|
7 | # custom logging # | |
8 | # # |
|
8 | # # | |
9 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
9 | # The %(here)s variable will be replaced with the parent directory of this file# | |
10 | ################################################################################ |
|
10 | ################################################################################ | |
11 | ################################################################################ |
|
11 | ################################################################################ | |
12 |
|
12 | |||
13 | [DEFAULT] |
|
13 | [DEFAULT] | |
14 | debug = true |
|
14 | debug = true | |
15 | pdebug = false |
|
15 | pdebug = false | |
16 |
|
16 | |||
17 | ################################################################################ |
|
17 | ################################################################################ | |
18 | ## Uncomment and replace with the address which should receive ## |
|
18 | ## Uncomment and replace with the address which should receive ## | |
19 | ## any error reports after application crash ## |
|
19 | ## any error reports after application crash ## | |
20 | ## Additionally those settings will be used by Kallithea mailing system ## |
|
20 | ## Additionally those settings will be used by Kallithea mailing system ## | |
21 | ################################################################################ |
|
21 | ################################################################################ | |
22 | #email_to = admin@localhost |
|
22 | #email_to = admin@localhost | |
23 | #error_email_from = paste_error@localhost |
|
23 | #error_email_from = paste_error@localhost | |
24 | #app_email_from = kallithea-noreply@localhost |
|
24 | #app_email_from = kallithea-noreply@localhost | |
25 | #error_message = |
|
25 | #error_message = | |
26 | #email_prefix = [Kallithea] |
|
26 | #email_prefix = [Kallithea] | |
27 |
|
27 | |||
28 | #smtp_server = mail.server.com |
|
28 | #smtp_server = mail.server.com | |
29 | #smtp_username = |
|
29 | #smtp_username = | |
30 | #smtp_password = |
|
30 | #smtp_password = | |
31 | #smtp_port = |
|
31 | #smtp_port = | |
32 | #smtp_use_tls = false |
|
32 | #smtp_use_tls = false | |
33 | #smtp_use_ssl = true |
|
33 | #smtp_use_ssl = true | |
34 | ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.) |
|
34 | ## Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.) | |
35 | #smtp_auth = |
|
35 | #smtp_auth = | |
36 |
|
36 | |||
37 | [server:main] |
|
37 | [server:main] | |
38 | ## PASTE ## |
|
38 | ## PASTE ## | |
39 | #use = egg:Paste#http |
|
39 | #use = egg:Paste#http | |
40 | ## nr of worker threads to spawn |
|
40 | ## nr of worker threads to spawn | |
41 | #threadpool_workers = 5 |
|
41 | #threadpool_workers = 5 | |
42 | ## max request before thread respawn |
|
42 | ## max request before thread respawn | |
43 | #threadpool_max_requests = 10 |
|
43 | #threadpool_max_requests = 10 | |
44 | ## option to use threads of process |
|
44 | ## option to use threads of process | |
45 | #use_threadpool = true |
|
45 | #use_threadpool = true | |
46 |
|
46 | |||
47 | ## WAITRESS ## |
|
47 | ## WAITRESS ## | |
48 | use = egg:waitress#main |
|
48 | use = egg:waitress#main | |
49 | ## number of worker threads |
|
49 | ## number of worker threads | |
50 | threads = 5 |
|
50 | threads = 5 | |
51 | ## MAX BODY SIZE 100GB |
|
51 | ## MAX BODY SIZE 100GB | |
52 | max_request_body_size = 107374182400 |
|
52 | max_request_body_size = 107374182400 | |
53 | ## use poll instead of select, fixes fd limits, may not work on old |
|
53 | ## use poll instead of select, fixes fd limits, may not work on old | |
54 | ## windows systems. |
|
54 | ## windows systems. | |
55 | #asyncore_use_poll = True |
|
55 | #asyncore_use_poll = True | |
56 |
|
56 | |||
57 | ## GUNICORN ## |
|
57 | ## GUNICORN ## | |
58 | #use = egg:gunicorn#main |
|
58 | #use = egg:gunicorn#main | |
59 | ## number of process workers. You must set `instance_id = *` when this option |
|
59 | ## number of process workers. You must set `instance_id = *` when this option | |
60 | ## is set to more than one worker |
|
60 | ## is set to more than one worker | |
61 | #workers = 1 |
|
61 | #workers = 1 | |
62 | ## process name |
|
62 | ## process name | |
63 | #proc_name = kallithea |
|
63 | #proc_name = kallithea | |
64 | ## type of worker class, one of sync, eventlet, gevent, tornado |
|
64 | ## type of worker class, one of sync, eventlet, gevent, tornado | |
65 | ## recommended for bigger setup is using of of other than sync one |
|
65 | ## recommended for bigger setup is using of of other than sync one | |
66 | #worker_class = sync |
|
66 | #worker_class = sync | |
67 | #max_requests = 1000 |
|
67 | #max_requests = 1000 | |
68 | ## ammount of time a worker can handle request before it gets killed and |
|
68 | ## ammount of time a worker can handle request before it gets killed and | |
69 | ## restarted |
|
69 | ## restarted | |
70 | #timeout = 3600 |
|
70 | #timeout = 3600 | |
71 |
|
71 | |||
72 | ## UWSGI ## |
|
72 | ## UWSGI ## | |
73 | ## run with uwsgi --ini-paste-logged <inifile.ini> |
|
73 | ## run with uwsgi --ini-paste-logged <inifile.ini> | |
74 | #[uwsgi] |
|
74 | #[uwsgi] | |
75 | #socket = /tmp/uwsgi.sock |
|
75 | #socket = /tmp/uwsgi.sock | |
76 | #master = true |
|
76 | #master = true | |
77 | #http = 127.0.0.1:5000 |
|
77 | #http = 127.0.0.1:5000 | |
78 |
|
78 | |||
79 | ## set as deamon and redirect all output to file |
|
79 | ## set as deamon and redirect all output to file | |
80 | #daemonize = ./uwsgi_kallithea.log |
|
80 | #daemonize = ./uwsgi_kallithea.log | |
81 |
|
81 | |||
82 | ## master process PID |
|
82 | ## master process PID | |
83 | #pidfile = ./uwsgi_kallithea.pid |
|
83 | #pidfile = ./uwsgi_kallithea.pid | |
84 |
|
84 | |||
85 | ## stats server with workers statistics, use uwsgitop |
|
85 | ## stats server with workers statistics, use uwsgitop | |
86 | ## for monitoring, `uwsgitop 127.0.0.1:1717` |
|
86 | ## for monitoring, `uwsgitop 127.0.0.1:1717` | |
87 | #stats = 127.0.0.1:1717 |
|
87 | #stats = 127.0.0.1:1717 | |
88 | #memory-report = true |
|
88 | #memory-report = true | |
89 |
|
89 | |||
90 | ## log 5XX errors |
|
90 | ## log 5XX errors | |
91 | #log-5xx = true |
|
91 | #log-5xx = true | |
92 |
|
92 | |||
93 | ## Set the socket listen queue size. |
|
93 | ## Set the socket listen queue size. | |
94 | #listen = 256 |
|
94 | #listen = 256 | |
95 |
|
95 | |||
96 | ## Gracefully Reload workers after the specified amount of managed requests |
|
96 | ## Gracefully Reload workers after the specified amount of managed requests | |
97 | ## (avoid memory leaks). |
|
97 | ## (avoid memory leaks). | |
98 | #max-requests = 1000 |
|
98 | #max-requests = 1000 | |
99 |
|
99 | |||
100 | ## enable large buffers |
|
100 | ## enable large buffers | |
101 | #buffer-size=65535 |
|
101 | #buffer-size=65535 | |
102 |
|
102 | |||
103 | ## socket and http timeouts ## |
|
103 | ## socket and http timeouts ## | |
104 | #http-timeout=3600 |
|
104 | #http-timeout=3600 | |
105 | #socket-timeout=3600 |
|
105 | #socket-timeout=3600 | |
106 |
|
106 | |||
107 | ## Log requests slower than the specified number of milliseconds. |
|
107 | ## Log requests slower than the specified number of milliseconds. | |
108 | #log-slow = 10 |
|
108 | #log-slow = 10 | |
109 |
|
109 | |||
110 | ## Exit if no app can be loaded. |
|
110 | ## Exit if no app can be loaded. | |
111 | #need-app = true |
|
111 | #need-app = true | |
112 |
|
112 | |||
113 | ## Set lazy mode (load apps in workers instead of master). |
|
113 | ## Set lazy mode (load apps in workers instead of master). | |
114 | #lazy = true |
|
114 | #lazy = true | |
115 |
|
115 | |||
116 | ## scaling ## |
|
116 | ## scaling ## | |
117 | ## set cheaper algorithm to use, if not set default will be used |
|
117 | ## set cheaper algorithm to use, if not set default will be used | |
118 | #cheaper-algo = spare |
|
118 | #cheaper-algo = spare | |
119 |
|
119 | |||
120 | ## minimum number of workers to keep at all times |
|
120 | ## minimum number of workers to keep at all times | |
121 | #cheaper = 1 |
|
121 | #cheaper = 1 | |
122 |
|
122 | |||
123 | ## number of workers to spawn at startup |
|
123 | ## number of workers to spawn at startup | |
124 | #cheaper-initial = 1 |
|
124 | #cheaper-initial = 1 | |
125 |
|
125 | |||
126 | ## maximum number of workers that can be spawned |
|
126 | ## maximum number of workers that can be spawned | |
127 | #workers = 4 |
|
127 | #workers = 4 | |
128 |
|
128 | |||
129 | ## how many workers should be spawned at a time |
|
129 | ## how many workers should be spawned at a time | |
130 | #cheaper-step = 1 |
|
130 | #cheaper-step = 1 | |
131 |
|
131 | |||
132 | ## COMMON ## |
|
132 | ## COMMON ## | |
133 | host = 127.0.0.1 |
|
133 | host = 127.0.0.1 | |
134 | port = 5000 |
|
134 | port = 5000 | |
135 |
|
135 | |||
136 | ## prefix middleware for rc |
|
136 | ## prefix middleware for rc | |
137 | #[filter:proxy-prefix] |
|
137 | #[filter:proxy-prefix] | |
138 | #use = egg:PasteDeploy#prefix |
|
138 | #use = egg:PasteDeploy#prefix | |
139 | #prefix = /<your-prefix> |
|
139 | #prefix = /<your-prefix> | |
140 |
|
140 | |||
141 | [app:main] |
|
141 | [app:main] | |
142 | use = egg:kallithea |
|
142 | use = egg:kallithea | |
143 | ## enable proxy prefix middleware |
|
143 | ## enable proxy prefix middleware | |
144 | #filter-with = proxy-prefix |
|
144 | #filter-with = proxy-prefix | |
145 |
|
145 | |||
146 | full_stack = true |
|
146 | full_stack = true | |
147 | static_files = true |
|
147 | static_files = true | |
148 | ## Available Languages: |
|
148 | ## Available Languages: | |
149 | ## de en fr ja pl pt_BR ru zh_CN zh_TW |
|
149 | ## de en fr ja pl pt_BR ru zh_CN zh_TW | |
150 | lang = en |
|
150 | lang = en | |
151 | cache_dir = %(here)s/data |
|
151 | cache_dir = %(here)s/data | |
152 | index_dir = %(here)s/data/index |
|
152 | index_dir = %(here)s/data/index | |
153 |
|
153 | |||
154 | ## perform a full repository scan on each server start, this should be |
|
154 | ## perform a full repository scan on each server start, this should be | |
155 | ## set to false after first startup, to allow faster server restarts. |
|
155 | ## set to false after first startup, to allow faster server restarts. | |
156 | #initial_repo_scan = false |
|
156 | #initial_repo_scan = false | |
157 | initial_repo_scan = true |
|
157 | initial_repo_scan = true | |
158 |
|
158 | |||
159 | ## uncomment and set this path to use archive download cache |
|
159 | ## uncomment and set this path to use archive download cache | |
160 | archive_cache_dir = %(here)s/tarballcache |
|
160 | archive_cache_dir = %(here)s/tarballcache | |
161 |
|
161 | |||
162 | ## change this to unique ID for security |
|
162 | ## change this to unique ID for security | |
163 | app_instance_uuid = test |
|
163 | app_instance_uuid = test | |
164 |
|
164 | |||
165 | ## cut off limit for large diffs (size in bytes) |
|
165 | ## cut off limit for large diffs (size in bytes) | |
166 | cut_off_limit = 256000 |
|
166 | cut_off_limit = 256000 | |
167 |
|
167 | |||
168 | ## use cache version of scm repo everywhere |
|
168 | ## use cache version of scm repo everywhere | |
169 | #vcs_full_cache = true |
|
169 | #vcs_full_cache = true | |
170 | vcs_full_cache = false |
|
170 | vcs_full_cache = false | |
171 |
|
171 | |||
172 | ## force https in Kallithea, fixes https redirects, assumes it's always https |
|
172 | ## force https in Kallithea, fixes https redirects, assumes it's always https | |
173 | force_https = false |
|
173 | force_https = false | |
174 |
|
174 | |||
175 | ## use Strict-Transport-Security headers |
|
175 | ## use Strict-Transport-Security headers | |
176 | use_htsts = false |
|
176 | use_htsts = false | |
177 |
|
177 | |||
178 | ## number of commits stats will parse on each iteration |
|
178 | ## number of commits stats will parse on each iteration | |
179 | commit_parse_limit = 25 |
|
179 | commit_parse_limit = 25 | |
180 |
|
180 | |||
181 | ## path to git executable |
|
181 | ## path to git executable | |
182 | git_path = git |
|
182 | git_path = git | |
183 |
|
183 | |||
184 | ## git rev filter option, --all is the default filter, if you need to |
|
184 | ## git rev filter option, --all is the default filter, if you need to | |
185 | ## hide all refs in changelog switch this to --branches --tags |
|
185 | ## hide all refs in changelog switch this to --branches --tags | |
186 | #git_rev_filter = --branches --tags |
|
186 | #git_rev_filter = --branches --tags | |
187 |
|
187 | |||
188 | ## RSS feed options |
|
188 | ## RSS feed options | |
189 | rss_cut_off_limit = 256000 |
|
189 | rss_cut_off_limit = 256000 | |
190 | rss_items_per_page = 10 |
|
190 | rss_items_per_page = 10 | |
191 | rss_include_diff = false |
|
191 | rss_include_diff = false | |
192 |
|
192 | |||
193 | ## options for showing and identifying changesets |
|
193 | ## options for showing and identifying changesets | |
194 | show_sha_length = 12 |
|
194 | show_sha_length = 12 | |
195 | show_revision_number = true |
|
195 | show_revision_number = true | |
196 |
|
196 | |||
197 | ## gist URL alias, used to create nicer urls for gist. This should be an |
|
197 | ## gist URL alias, used to create nicer urls for gist. This should be an | |
198 | ## url that does rewrites to _admin/gists/<gistid>. |
|
198 | ## url that does rewrites to _admin/gists/<gistid>. | |
199 | ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal |
|
199 | ## example: http://gist.kallithea.server/{gistid}. Empty means use the internal | |
200 | ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid> |
|
200 | ## Kallithea url, ie. http[s]://your.kallithea.server/_admin/gists/<gistid> | |
201 | gist_alias_url = |
|
201 | gist_alias_url = | |
202 |
|
202 | |||
203 | ## white list of API enabled controllers. This allows to add list of |
|
203 | ## white list of API enabled controllers. This allows to add list of | |
204 | ## controllers to which access will be enabled by api_key. eg: to enable |
|
204 | ## controllers to which access will be enabled by api_key. eg: to enable | |
205 | ## api access to raw_files put `FilesController:raw`, to enable access to patches |
|
205 | ## api access to raw_files put `FilesController:raw`, to enable access to patches | |
206 | ## add `ChangesetController:changeset_patch`. This list should be "," separated |
|
206 | ## add `ChangesetController:changeset_patch`. This list should be "," separated | |
207 | ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names |
|
207 | ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names | |
208 | ## Recommended settings below are commented out: |
|
208 | ## Recommended settings below are commented out: | |
209 | api_access_controllers_whitelist = |
|
209 | api_access_controllers_whitelist = | |
210 | # ChangesetController:changeset_patch, |
|
210 | # ChangesetController:changeset_patch, | |
211 | # ChangesetController:changeset_raw, |
|
211 | # ChangesetController:changeset_raw, | |
212 | # FilesController:raw, |
|
212 | # FilesController:raw, | |
213 | # FilesController:archivefile |
|
213 | # FilesController:archivefile | |
214 |
|
214 | |||
215 | ## default encoding used to convert from and to unicode |
|
215 | ## default encoding used to convert from and to unicode | |
216 | ## can be also a comma seperated list of encoding in case of mixed encodings |
|
216 | ## can be also a comma seperated list of encoding in case of mixed encodings | |
217 | default_encoding = utf8 |
|
217 | default_encoding = utf8 | |
218 |
|
218 | |||
219 | ## issue tracker for Kallithea (leave blank to disable, absent for default) |
|
219 | ## issue tracker for Kallithea (leave blank to disable, absent for default) | |
220 | #bugtracker = https://bitbucket.org/conservancy/kallithea/issues |
|
220 | #bugtracker = https://bitbucket.org/conservancy/kallithea/issues | |
221 |
|
221 | |||
222 | ## issue tracking mapping for commits messages |
|
222 | ## issue tracking mapping for commits messages | |
223 | ## comment out issue_pat, issue_server, issue_prefix to enable |
|
223 | ## comment out issue_pat, issue_server, issue_prefix to enable | |
224 |
|
224 | |||
225 | ## pattern to get the issues from commit messages |
|
225 | ## pattern to get the issues from commit messages | |
226 | ## default one used here is #<numbers> with a regex passive group for `#` |
|
226 | ## default one used here is #<numbers> with a regex passive group for `#` | |
227 | ## {id} will be all groups matched from this pattern |
|
227 | ## {id} will be all groups matched from this pattern | |
228 |
|
228 | |||
229 | issue_pat = (?:\s*#)(\d+) |
|
229 | issue_pat = (?:\s*#)(\d+) | |
230 |
|
230 | |||
231 | ## server url to the issue, each {id} will be replaced with match |
|
231 | ## server url to the issue, each {id} will be replaced with match | |
232 | ## fetched from the regex and {repo} is replaced with full repository name |
|
232 | ## fetched from the regex and {repo} is replaced with full repository name | |
233 | ## including groups {repo_name} is replaced with just name of repo |
|
233 | ## including groups {repo_name} is replaced with just name of repo | |
234 |
|
234 | |||
235 | issue_server_link = https://myissueserver.com/{repo}/issue/{id} |
|
235 | issue_server_link = https://myissueserver.com/{repo}/issue/{id} | |
236 |
|
236 | |||
237 | ## prefix to add to link to indicate it's an url |
|
237 | ## prefix to add to link to indicate it's an url | |
238 | ## #314 will be replaced by <issue_prefix><id> |
|
238 | ## #314 will be replaced by <issue_prefix><id> | |
239 |
|
239 | |||
240 | issue_prefix = # |
|
240 | issue_prefix = # | |
241 |
|
241 | |||
242 | ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify |
|
242 | ## issue_pat, issue_server_link, issue_prefix can have suffixes to specify | |
243 | ## multiple patterns, to other issues server, wiki or others |
|
243 | ## multiple patterns, to other issues server, wiki or others | |
244 | ## below an example how to create a wiki pattern |
|
244 | ## below an example how to create a wiki pattern | |
245 | # wiki-some-id -> https://mywiki.com/some-id |
|
245 | # wiki-some-id -> https://mywiki.com/some-id | |
246 |
|
246 | |||
247 | #issue_pat_wiki = (?:wiki-)(.+) |
|
247 | #issue_pat_wiki = (?:wiki-)(.+) | |
248 | #issue_server_link_wiki = https://mywiki.com/{id} |
|
248 | #issue_server_link_wiki = https://mywiki.com/{id} | |
249 | #issue_prefix_wiki = WIKI- |
|
249 | #issue_prefix_wiki = WIKI- | |
250 |
|
250 | |||
251 |
|
251 | |||
252 | ## instance-id prefix |
|
252 | ## instance-id prefix | |
253 | ## a prefix key for this instance used for cache invalidation when running |
|
253 | ## a prefix key for this instance used for cache invalidation when running | |
254 | ## multiple instances of kallithea, make sure it's globally unique for |
|
254 | ## multiple instances of kallithea, make sure it's globally unique for | |
255 | ## all running kallithea instances. Leave empty if you don't use it |
|
255 | ## all running kallithea instances. Leave empty if you don't use it | |
256 | instance_id = |
|
256 | instance_id = | |
257 |
|
257 | |||
258 | ## alternative return HTTP header for failed authentication. Default HTTP |
|
258 | ## alternative return HTTP header for failed authentication. Default HTTP | |
259 | ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with |
|
259 | ## response is 401 HTTPUnauthorized. Currently Mercurial clients have trouble with | |
260 | ## handling that. Set this variable to 403 to return HTTPForbidden |
|
260 | ## handling that. Set this variable to 403 to return HTTPForbidden | |
261 | auth_ret_code = |
|
261 | auth_ret_code = | |
262 |
|
262 | |||
263 | ## locking return code. When repository is locked return this HTTP code. 2XX |
|
263 | ## locking return code. When repository is locked return this HTTP code. 2XX | |
264 | ## codes don't break the transactions while 4XX codes do |
|
264 | ## codes don't break the transactions while 4XX codes do | |
265 | lock_ret_code = 423 |
|
265 | lock_ret_code = 423 | |
266 |
|
266 | |||
267 | ## allows to change the repository location in settings page |
|
267 | ## allows to change the repository location in settings page | |
268 | allow_repo_location_change = True |
|
268 | allow_repo_location_change = True | |
269 |
|
269 | |||
270 | ## allows to setup custom hooks in settings page |
|
270 | ## allows to setup custom hooks in settings page | |
271 | allow_custom_hooks_settings = True |
|
271 | allow_custom_hooks_settings = True | |
272 |
|
272 | |||
273 |
|
273 | |||
274 | #################################### |
|
274 | #################################### | |
275 | ### CELERY CONFIG #### |
|
275 | ### CELERY CONFIG #### | |
276 | #################################### |
|
276 | #################################### | |
277 |
|
277 | |||
278 | use_celery = false |
|
278 | use_celery = false | |
279 | broker.host = localhost |
|
279 | broker.host = localhost | |
280 | broker.vhost = rabbitmqhost |
|
280 | broker.vhost = rabbitmqhost | |
281 | broker.port = 5672 |
|
281 | broker.port = 5672 | |
282 | broker.user = rabbitmq |
|
282 | broker.user = rabbitmq | |
283 | broker.password = qweqwe |
|
283 | broker.password = qweqwe | |
284 |
|
284 | |||
285 | celery.imports = kallithea.lib.celerylib.tasks |
|
285 | celery.imports = kallithea.lib.celerylib.tasks | |
286 |
|
286 | |||
287 | celery.result.backend = amqp |
|
287 | celery.result.backend = amqp | |
288 | celery.result.dburi = amqp:// |
|
288 | celery.result.dburi = amqp:// | |
289 | celery.result.serialier = json |
|
289 | celery.result.serialier = json | |
290 |
|
290 | |||
291 | #celery.send.task.error.emails = true |
|
291 | #celery.send.task.error.emails = true | |
292 | #celery.amqp.task.result.expires = 18000 |
|
292 | #celery.amqp.task.result.expires = 18000 | |
293 |
|
293 | |||
294 | celeryd.concurrency = 2 |
|
294 | celeryd.concurrency = 2 | |
295 | #celeryd.log.file = celeryd.log |
|
295 | #celeryd.log.file = celeryd.log | |
296 | celeryd.log.level = debug |
|
296 | celeryd.log.level = debug | |
297 | celeryd.max.tasks.per.child = 1 |
|
297 | celeryd.max.tasks.per.child = 1 | |
298 |
|
298 | |||
299 | ## tasks will never be sent to the queue, but executed locally instead. |
|
299 | ## tasks will never be sent to the queue, but executed locally instead. | |
300 | celery.always.eager = false |
|
300 | celery.always.eager = false | |
301 |
|
301 | |||
302 | #################################### |
|
302 | #################################### | |
303 | ### BEAKER CACHE #### |
|
303 | ### BEAKER CACHE #### | |
304 | #################################### |
|
304 | #################################### | |
305 |
|
305 | |||
306 | beaker.cache.data_dir=%(here)s/data/cache/data |
|
306 | beaker.cache.data_dir=%(here)s/data/cache/data | |
307 | beaker.cache.lock_dir=%(here)s/data/cache/lock |
|
307 | beaker.cache.lock_dir=%(here)s/data/cache/lock | |
308 |
|
308 | |||
309 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long |
|
309 | beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long | |
310 |
|
310 | |||
311 | beaker.cache.super_short_term.type=memory |
|
311 | beaker.cache.super_short_term.type=memory | |
312 | beaker.cache.super_short_term.expire=10 |
|
312 | beaker.cache.super_short_term.expire=10 | |
313 | beaker.cache.super_short_term.key_length = 256 |
|
313 | beaker.cache.super_short_term.key_length = 256 | |
314 |
|
314 | |||
315 | beaker.cache.short_term.type=memory |
|
315 | beaker.cache.short_term.type=memory | |
316 | beaker.cache.short_term.expire=60 |
|
316 | beaker.cache.short_term.expire=60 | |
317 | beaker.cache.short_term.key_length = 256 |
|
317 | beaker.cache.short_term.key_length = 256 | |
318 |
|
318 | |||
319 | beaker.cache.long_term.type=memory |
|
319 | beaker.cache.long_term.type=memory | |
320 | beaker.cache.long_term.expire=36000 |
|
320 | beaker.cache.long_term.expire=36000 | |
321 | beaker.cache.long_term.key_length = 256 |
|
321 | beaker.cache.long_term.key_length = 256 | |
322 |
|
322 | |||
323 | beaker.cache.sql_cache_short.type=memory |
|
323 | beaker.cache.sql_cache_short.type=memory | |
324 |
beaker.cache.sql_cache_short.expire=1 |
|
324 | beaker.cache.sql_cache_short.expire=1 | |
325 | beaker.cache.sql_cache_short.key_length = 256 |
|
325 | beaker.cache.sql_cache_short.key_length = 256 | |
326 |
|
326 | |||
327 | beaker.cache.sql_cache_med.type=memory |
|
327 | beaker.cache.sql_cache_med.type=memory | |
328 | beaker.cache.sql_cache_med.expire=360 |
|
328 | beaker.cache.sql_cache_med.expire=360 | |
329 | beaker.cache.sql_cache_med.key_length = 256 |
|
329 | beaker.cache.sql_cache_med.key_length = 256 | |
330 |
|
330 | |||
331 | beaker.cache.sql_cache_long.type=file |
|
331 | beaker.cache.sql_cache_long.type=file | |
332 | beaker.cache.sql_cache_long.expire=3600 |
|
332 | beaker.cache.sql_cache_long.expire=3600 | |
333 | beaker.cache.sql_cache_long.key_length = 256 |
|
333 | beaker.cache.sql_cache_long.key_length = 256 | |
334 |
|
334 | |||
335 | #################################### |
|
335 | #################################### | |
336 | ### BEAKER SESSION #### |
|
336 | ### BEAKER SESSION #### | |
337 | #################################### |
|
337 | #################################### | |
338 | ## Type of storage used for the session, current types are |
|
338 | ## Type of storage used for the session, current types are | |
339 | ## dbm, file, memcached, database, and memory. |
|
339 | ## dbm, file, memcached, database, and memory. | |
340 | ## The storage uses the Container API |
|
340 | ## The storage uses the Container API | |
341 | ## that is also used by the cache system. |
|
341 | ## that is also used by the cache system. | |
342 |
|
342 | |||
343 | ## db session ## |
|
343 | ## db session ## | |
344 | #beaker.session.type = ext:database |
|
344 | #beaker.session.type = ext:database | |
345 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea |
|
345 | #beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea | |
346 | #beaker.session.table_name = db_session |
|
346 | #beaker.session.table_name = db_session | |
347 |
|
347 | |||
348 | ## encrypted cookie client side session, good for many instances ## |
|
348 | ## encrypted cookie client side session, good for many instances ## | |
349 | #beaker.session.type = cookie |
|
349 | #beaker.session.type = cookie | |
350 |
|
350 | |||
351 | ## file based cookies (default) ## |
|
351 | ## file based cookies (default) ## | |
352 | #beaker.session.type = file |
|
352 | #beaker.session.type = file | |
353 |
|
353 | |||
354 | beaker.session.key = kallithea |
|
354 | beaker.session.key = kallithea | |
355 | beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f} |
|
355 | beaker.session.secret = {74e0cd75-b339-478b-b129-07dd221def1f} | |
356 |
|
356 | |||
357 | ## Secure encrypted cookie. Requires AES and AES python libraries |
|
357 | ## Secure encrypted cookie. Requires AES and AES python libraries | |
358 | ## you must disable beaker.session.secret to use this |
|
358 | ## you must disable beaker.session.secret to use this | |
359 | #beaker.session.encrypt_key = <key_for_encryption> |
|
359 | #beaker.session.encrypt_key = <key_for_encryption> | |
360 | #beaker.session.validate_key = <validation_key> |
|
360 | #beaker.session.validate_key = <validation_key> | |
361 |
|
361 | |||
362 | ## sets session as invalid if it haven't been accessed for given amount of time |
|
362 | ## sets session as invalid if it haven't been accessed for given amount of time | |
363 | beaker.session.timeout = 2592000 |
|
363 | beaker.session.timeout = 2592000 | |
364 | beaker.session.httponly = true |
|
364 | beaker.session.httponly = true | |
365 | #beaker.session.cookie_path = /<your-prefix> |
|
365 | #beaker.session.cookie_path = /<your-prefix> | |
366 |
|
366 | |||
367 | ## uncomment for https secure cookie |
|
367 | ## uncomment for https secure cookie | |
368 | beaker.session.secure = false |
|
368 | beaker.session.secure = false | |
369 |
|
369 | |||
370 | ## auto save the session to not to use .save() |
|
370 | ## auto save the session to not to use .save() | |
371 | beaker.session.auto = False |
|
371 | beaker.session.auto = False | |
372 |
|
372 | |||
373 | ## default cookie expiration time in seconds `true` expire at browser close ## |
|
373 | ## default cookie expiration time in seconds `true` expire at browser close ## | |
374 | #beaker.session.cookie_expires = 3600 |
|
374 | #beaker.session.cookie_expires = 3600 | |
375 |
|
375 | |||
376 |
|
376 | |||
377 | ############################ |
|
377 | ############################ | |
378 | ## ERROR HANDLING SYSTEMS ## |
|
378 | ## ERROR HANDLING SYSTEMS ## | |
379 | ############################ |
|
379 | ############################ | |
380 |
|
380 | |||
381 | #################### |
|
381 | #################### | |
382 | ### [errormator] ### |
|
382 | ### [errormator] ### | |
383 | #################### |
|
383 | #################### | |
384 |
|
384 | |||
385 | ## Errormator is tailored to work with Kallithea, see |
|
385 | ## Errormator is tailored to work with Kallithea, see | |
386 | ## http://errormator.com for details how to obtain an account |
|
386 | ## http://errormator.com for details how to obtain an account | |
387 | ## you must install python package `errormator_client` to make it work |
|
387 | ## you must install python package `errormator_client` to make it work | |
388 |
|
388 | |||
389 | ## errormator enabled |
|
389 | ## errormator enabled | |
390 | errormator = false |
|
390 | errormator = false | |
391 |
|
391 | |||
392 | errormator.server_url = https://api.errormator.com |
|
392 | errormator.server_url = https://api.errormator.com | |
393 | errormator.api_key = YOUR_API_KEY |
|
393 | errormator.api_key = YOUR_API_KEY | |
394 |
|
394 | |||
395 | ## TWEAK AMOUNT OF INFO SENT HERE |
|
395 | ## TWEAK AMOUNT OF INFO SENT HERE | |
396 |
|
396 | |||
397 | ## enables 404 error logging (default False) |
|
397 | ## enables 404 error logging (default False) | |
398 | errormator.report_404 = false |
|
398 | errormator.report_404 = false | |
399 |
|
399 | |||
400 | ## time in seconds after request is considered being slow (default 1) |
|
400 | ## time in seconds after request is considered being slow (default 1) | |
401 | errormator.slow_request_time = 1 |
|
401 | errormator.slow_request_time = 1 | |
402 |
|
402 | |||
403 | ## record slow requests in application |
|
403 | ## record slow requests in application | |
404 | ## (needs to be enabled for slow datastore recording and time tracking) |
|
404 | ## (needs to be enabled for slow datastore recording and time tracking) | |
405 | errormator.slow_requests = true |
|
405 | errormator.slow_requests = true | |
406 |
|
406 | |||
407 | ## enable hooking to application loggers |
|
407 | ## enable hooking to application loggers | |
408 | # errormator.logging = true |
|
408 | # errormator.logging = true | |
409 |
|
409 | |||
410 | ## minimum log level for log capture |
|
410 | ## minimum log level for log capture | |
411 | # errormator.logging.level = WARNING |
|
411 | # errormator.logging.level = WARNING | |
412 |
|
412 | |||
413 | ## send logs only from erroneous/slow requests |
|
413 | ## send logs only from erroneous/slow requests | |
414 | ## (saves API quota for intensive logging) |
|
414 | ## (saves API quota for intensive logging) | |
415 | errormator.logging_on_error = false |
|
415 | errormator.logging_on_error = false | |
416 |
|
416 | |||
417 | ## list of additonal keywords that should be grabbed from environ object |
|
417 | ## list of additonal keywords that should be grabbed from environ object | |
418 | ## can be string with comma separated list of words in lowercase |
|
418 | ## can be string with comma separated list of words in lowercase | |
419 | ## (by default client will always send following info: |
|
419 | ## (by default client will always send following info: | |
420 | ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that |
|
420 | ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that | |
421 | ## start with HTTP* this list be extended with additional keywords here |
|
421 | ## start with HTTP* this list be extended with additional keywords here | |
422 | errormator.environ_keys_whitelist = |
|
422 | errormator.environ_keys_whitelist = | |
423 |
|
423 | |||
424 |
|
424 | |||
425 | ## list of keywords that should be blanked from request object |
|
425 | ## list of keywords that should be blanked from request object | |
426 | ## can be string with comma separated list of words in lowercase |
|
426 | ## can be string with comma separated list of words in lowercase | |
427 | ## (by default client will always blank keys that contain following words |
|
427 | ## (by default client will always blank keys that contain following words | |
428 | ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf' |
|
428 | ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf' | |
429 | ## this list be extended with additional keywords set here |
|
429 | ## this list be extended with additional keywords set here | |
430 | errormator.request_keys_blacklist = |
|
430 | errormator.request_keys_blacklist = | |
431 |
|
431 | |||
432 |
|
432 | |||
433 | ## list of namespaces that should be ignores when gathering log entries |
|
433 | ## list of namespaces that should be ignores when gathering log entries | |
434 | ## can be string with comma separated list of namespaces |
|
434 | ## can be string with comma separated list of namespaces | |
435 | ## (by default the client ignores own entries: errormator_client.client) |
|
435 | ## (by default the client ignores own entries: errormator_client.client) | |
436 | errormator.log_namespace_blacklist = |
|
436 | errormator.log_namespace_blacklist = | |
437 |
|
437 | |||
438 |
|
438 | |||
439 | ################ |
|
439 | ################ | |
440 | ### [sentry] ### |
|
440 | ### [sentry] ### | |
441 | ################ |
|
441 | ################ | |
442 |
|
442 | |||
443 | ## sentry is a alternative open source error aggregator |
|
443 | ## sentry is a alternative open source error aggregator | |
444 | ## you must install python packages `sentry` and `raven` to enable |
|
444 | ## you must install python packages `sentry` and `raven` to enable | |
445 |
|
445 | |||
446 | sentry.dsn = YOUR_DNS |
|
446 | sentry.dsn = YOUR_DNS | |
447 | sentry.servers = |
|
447 | sentry.servers = | |
448 | sentry.name = |
|
448 | sentry.name = | |
449 | sentry.key = |
|
449 | sentry.key = | |
450 | sentry.public_key = |
|
450 | sentry.public_key = | |
451 | sentry.secret_key = |
|
451 | sentry.secret_key = | |
452 | sentry.project = |
|
452 | sentry.project = | |
453 | sentry.site = |
|
453 | sentry.site = | |
454 | sentry.include_paths = |
|
454 | sentry.include_paths = | |
455 | sentry.exclude_paths = |
|
455 | sentry.exclude_paths = | |
456 |
|
456 | |||
457 |
|
457 | |||
458 | ################################################################################ |
|
458 | ################################################################################ | |
459 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
459 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## | |
460 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
460 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## | |
461 | ## execute malicious code after an exception is raised. ## |
|
461 | ## execute malicious code after an exception is raised. ## | |
462 | ################################################################################ |
|
462 | ################################################################################ | |
463 | set debug = false |
|
463 | set debug = false | |
464 |
|
464 | |||
465 | ################################## |
|
465 | ################################## | |
466 | ### LOGVIEW CONFIG ### |
|
466 | ### LOGVIEW CONFIG ### | |
467 | ################################## |
|
467 | ################################## | |
468 |
|
468 | |||
469 | logview.sqlalchemy = #faa |
|
469 | logview.sqlalchemy = #faa | |
470 | logview.pylons.templating = #bfb |
|
470 | logview.pylons.templating = #bfb | |
471 | logview.pylons.util = #eee |
|
471 | logview.pylons.util = #eee | |
472 |
|
472 | |||
473 | ######################################################### |
|
473 | ######################################################### | |
474 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
474 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
475 | ######################################################### |
|
475 | ######################################################### | |
476 |
|
476 | |||
477 | # SQLITE [default] |
|
477 | # SQLITE [default] | |
478 | #sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60 |
|
478 | #sqlalchemy.db1.url = sqlite:///%(here)s/kallithea.db?timeout=60 | |
479 | sqlalchemy.db1.url = sqlite:///%(here)s/kallithea_test.sqlite |
|
479 | sqlalchemy.db1.url = sqlite:///%(here)s/kallithea_test.sqlite | |
480 |
|
480 | |||
481 | # POSTGRESQL |
|
481 | # POSTGRESQL | |
482 | # sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea |
|
482 | # sqlalchemy.db1.url = postgresql://user:pass@localhost/kallithea | |
483 |
|
483 | |||
484 | # MySQL |
|
484 | # MySQL | |
485 | # sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea |
|
485 | # sqlalchemy.db1.url = mysql://user:pass@localhost/kallithea | |
486 |
|
486 | |||
487 | # see sqlalchemy docs for others |
|
487 | # see sqlalchemy docs for others | |
488 |
|
488 | |||
489 | sqlalchemy.db1.echo = false |
|
489 | sqlalchemy.db1.echo = false | |
490 | sqlalchemy.db1.pool_recycle = 3600 |
|
490 | sqlalchemy.db1.pool_recycle = 3600 | |
491 | sqlalchemy.db1.convert_unicode = true |
|
491 | sqlalchemy.db1.convert_unicode = true | |
492 |
|
492 | |||
493 | ################################ |
|
493 | ################################ | |
494 | ### LOGGING CONFIGURATION #### |
|
494 | ### LOGGING CONFIGURATION #### | |
495 | ################################ |
|
495 | ################################ | |
496 |
|
496 | |||
497 | [loggers] |
|
497 | [loggers] | |
498 | keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer |
|
498 | keys = root, routes, kallithea, sqlalchemy, beaker, templates, whoosh_indexer | |
499 |
|
499 | |||
500 | [handlers] |
|
500 | [handlers] | |
501 | keys = console, console_sql |
|
501 | keys = console, console_sql | |
502 |
|
502 | |||
503 | [formatters] |
|
503 | [formatters] | |
504 | keys = generic, color_formatter, color_formatter_sql |
|
504 | keys = generic, color_formatter, color_formatter_sql | |
505 |
|
505 | |||
506 | ############# |
|
506 | ############# | |
507 | ## LOGGERS ## |
|
507 | ## LOGGERS ## | |
508 | ############# |
|
508 | ############# | |
509 |
|
509 | |||
510 | [logger_root] |
|
510 | [logger_root] | |
511 | #level = NOTSET |
|
511 | #level = NOTSET | |
512 | level = DEBUG |
|
512 | level = DEBUG | |
513 | handlers = console |
|
513 | handlers = console | |
514 |
|
514 | |||
515 | [logger_routes] |
|
515 | [logger_routes] | |
516 | level = DEBUG |
|
516 | level = DEBUG | |
517 | handlers = |
|
517 | handlers = | |
518 | qualname = routes.middleware |
|
518 | qualname = routes.middleware | |
519 | ## "level = DEBUG" logs the route matched and routing variables. |
|
519 | ## "level = DEBUG" logs the route matched and routing variables. | |
520 | propagate = 1 |
|
520 | propagate = 1 | |
521 |
|
521 | |||
522 | [logger_beaker] |
|
522 | [logger_beaker] | |
523 | level = DEBUG |
|
523 | level = DEBUG | |
524 | handlers = |
|
524 | handlers = | |
525 | qualname = beaker.container |
|
525 | qualname = beaker.container | |
526 | propagate = 1 |
|
526 | propagate = 1 | |
527 |
|
527 | |||
528 | [logger_templates] |
|
528 | [logger_templates] | |
529 | level = INFO |
|
529 | level = INFO | |
530 | handlers = |
|
530 | handlers = | |
531 | qualname = pylons.templating |
|
531 | qualname = pylons.templating | |
532 | propagate = 1 |
|
532 | propagate = 1 | |
533 |
|
533 | |||
534 | [logger_kallithea] |
|
534 | [logger_kallithea] | |
535 | level = DEBUG |
|
535 | level = DEBUG | |
536 | handlers = |
|
536 | handlers = | |
537 | qualname = kallithea |
|
537 | qualname = kallithea | |
538 | propagate = 1 |
|
538 | propagate = 1 | |
539 |
|
539 | |||
540 | [logger_sqlalchemy] |
|
540 | [logger_sqlalchemy] | |
541 | #level = INFO |
|
541 | #level = INFO | |
542 | #handlers = console_sql |
|
542 | #handlers = console_sql | |
543 | level = ERROR |
|
543 | level = ERROR | |
544 | handlers = console |
|
544 | handlers = console | |
545 | qualname = sqlalchemy.engine |
|
545 | qualname = sqlalchemy.engine | |
546 | propagate = 0 |
|
546 | propagate = 0 | |
547 |
|
547 | |||
548 | [logger_whoosh_indexer] |
|
548 | [logger_whoosh_indexer] | |
549 | level = DEBUG |
|
549 | level = DEBUG | |
550 | handlers = |
|
550 | handlers = | |
551 | qualname = whoosh_indexer |
|
551 | qualname = whoosh_indexer | |
552 | propagate = 1 |
|
552 | propagate = 1 | |
553 |
|
553 | |||
554 | ############## |
|
554 | ############## | |
555 | ## HANDLERS ## |
|
555 | ## HANDLERS ## | |
556 | ############## |
|
556 | ############## | |
557 |
|
557 | |||
558 | [handler_console] |
|
558 | [handler_console] | |
559 | class = StreamHandler |
|
559 | class = StreamHandler | |
560 | args = (sys.stderr,) |
|
560 | args = (sys.stderr,) | |
561 | #level = INFO |
|
561 | #level = INFO | |
562 | level = NOTSET |
|
562 | level = NOTSET | |
563 | formatter = generic |
|
563 | formatter = generic | |
564 |
|
564 | |||
565 | [handler_console_sql] |
|
565 | [handler_console_sql] | |
566 | class = StreamHandler |
|
566 | class = StreamHandler | |
567 | args = (sys.stderr,) |
|
567 | args = (sys.stderr,) | |
568 | level = WARN |
|
568 | level = WARN | |
569 | formatter = generic |
|
569 | formatter = generic | |
570 |
|
570 | |||
571 | ################ |
|
571 | ################ | |
572 | ## FORMATTERS ## |
|
572 | ## FORMATTERS ## | |
573 | ################ |
|
573 | ################ | |
574 |
|
574 | |||
575 | [formatter_generic] |
|
575 | [formatter_generic] | |
576 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
576 | format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
577 | datefmt = %Y-%m-%d %H:%M:%S |
|
577 | datefmt = %Y-%m-%d %H:%M:%S | |
578 |
|
578 | |||
579 | [formatter_color_formatter] |
|
579 | [formatter_color_formatter] | |
580 | class=kallithea.lib.colored_formatter.ColorFormatter |
|
580 | class=kallithea.lib.colored_formatter.ColorFormatter | |
581 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
581 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
582 | datefmt = %Y-%m-%d %H:%M:%S |
|
582 | datefmt = %Y-%m-%d %H:%M:%S | |
583 |
|
583 | |||
584 | [formatter_color_formatter_sql] |
|
584 | [formatter_color_formatter_sql] | |
585 | class=kallithea.lib.colored_formatter.ColorFormatterSql |
|
585 | class=kallithea.lib.colored_formatter.ColorFormatterSql | |
586 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
586 | format= %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s | |
587 | datefmt = %Y-%m-%d %H:%M:%S |
|
587 | datefmt = %Y-%m-%d %H:%M:%S |
General Comments 0
You need to be logged in to leave comments.
Login now