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