summaryrefslogtreecommitdiffstats
path: root/roles/distgit/pagure/templates/pagure.cfg
blob: f3dd2c466a5b565712a582c1368b77a812ad64be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
from datetime import timedelta
import os

os.umask(0o002)

### Set the time after which the admin session expires
# There are two sessions on pagure, login that holds for 31 days and
# the session defined here after which an user has to re-login.
# This session is used when accessing all administrative parts of pagure
# (ie: changing a project's or a user's settings)
ADMIN_SESSION_LIFETIME = timedelta(minutes=20)

### Secret key for the Flask application
SECRET_KEY='{{ distgit_pagure_secret_key }}'
SALT_EMAIL='{{ distgit_pagure_secret_salt_email }}'

{% if env == 'staging' %}
EMAIL_SEND = False
{% else %}
EMAIL_SEND = True
{% endif %}

# This is required so that login specifies https
PREFERRED_URL_SCHEME='https'

### url to the database server:
#DB_URL=mysql://user:pass@host/db_name
#DB_URL=postgres://user:pass@host/db_name
DB_URL = 'postgresql://{{ distgit_pagure_db_user }}:{{ distgit_pagure_db_pass }}@{{ distgit_pagure_db_host }}/{{ distgit_pagure_db_name }}'

### FAS groups of pagure admins
ADMIN_GROUP = ['cvsadmin', 'sysadmin-main']

# The publicly visible admin email address
ADMIN_EMAIL = 'admin@fedoraproject.org'

### The email address to which the flask.log will send the errors (tracebacks)
EMAIL_ERROR = 'pingou@pingoured.fr'

### Default SMTP server to use for sending emails
SMTP_SERVER = 'bastion'

### Email used to sent emails
{% if env == 'staging' %}
FROM_EMAIL = 'pagure@pkgs.stg.fedoraproject.org'
DOMAIN_EMAIL_NOTIFICATIONS = 'src.stg.fedoraproject.org'
{% else %}
FROM_EMAIL = 'pagure@pkgs.fedoraproject.org'
DOMAIN_EMAIL_NOTIFICATIONS = 'src.fedoraproject.org'
{% endif %}

### Datagrepper info for the user profile
{% if env == 'staging' %}
DATAGREPPER_URL = 'https://apps.stg.fedoraproject.org/datagrepper'
{% else %}
DATAGREPPER_URL = 'https://apps.fedoraproject.org/datagrepper'
{% endif %}
DATAGREPPER_CATEGORY = 'pagure'

### The URL to use to clone git repositories.
{% if env == 'staging' %}
GIT_URL_SSH = 'ssh://{username}@pkgs.stg.fedoraproject.org/'
GIT_URL_GIT = 'https://src.stg.fedoraproject.org/'
{% else %}
GIT_URL_SSH = 'ssh://{username}@pkgs.fedoraproject.org/'
GIT_URL_GIT = 'https://src.fedoraproject.org/'
{% endif %}

### The IP addresses allowed for the internal endpoints
{% if env == 'staging' %}
IP_ALLOWED_INTERNAL = ['127.0.0.1', 'localhost', '::1', '10.5.128.177']
{% else %}
IP_ALLOWED_INTERNAL = ['127.0.0.1', 'localhost', '::1', '10.5.126.51', '10.5.126.52']
{% endif %}

# Redis configuration
{% if env == 'staging' %}
#EVENTSOURCE_SOURCE = 'https://src.stg.fedoraproject.org:8088'
{% else %}
#EVENTSOURCE_SOURCE = 'https://src.stg.fedoraproject.org:8088'
{% endif %}

# Optional configuration

### Number of items displayed per page
# Used when listing items
ITEM_PER_PAGE = 48

### Maximum size of the uploaded content
# Used to limit the size of file attached to a ticket for example
MAX_CONTENT_LENGTH = 2 * 1024 * 1024  # 2 megabytes

### Lenght for short commits ids or file hex
SHORT_LENGTH = 6

# Authentication related configuration option

### Switch the authentication method
# Specify which authentication method to use, defaults to `fas` can be or
# `local`
# Default: ``fas``.
PAGURE_AUTH = 'fas'

# When this is set to True, the session cookie will only be returned to the
# server via ssl (https). If you connect to the server via plain http, the
# cookie will not be sent. This prevents sniffing of the cookie contents.
# This may be set to False when testing your application but should always
# be set to True in production.
# Default: ``True``.
SESSION_COOKIE_SECURE = True

# The name of the cookie used to store the session id.
# Default: ``.pagure``.
SESSION_COOKIE_NAME = 'disgit_pagure'

# Boolean specifying wether to check the user's IP address when retrieving
# its session. This make things more secure (thus is on by default) but
# under certain setup it might not work (for example is there are proxies
# in front of the application).
CHECK_SESSION_IP = True

# Used by SESSION_COOKIE_PATH
APPLICATION_ROOT = '/'

# Set the SSH certs/keys
{% if env == 'staging' %}
SSH_KEYS = {
    'RSA': {
        'fingerprint': '2048 ce:e8:a7:2b:7a:6a:9c:6f:f0:e7:ab:bb:a0:c4:f3:f2   (RSA)',
        'pubkey': 'pkgs.stg.fedoraproject.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7kE4Zst3uYFPdoJN341v+annUShkcu+ODT93JX95OfOwbqQP3ZeCG3Nl1+mHOcRg8mRqxmf8FadzjSVoGKf8rWdAQA4vawS8b98XyHp7oCIS6Ydv+wVtFy1ecGHn9yEvuiVLU6G2nn9LJ5rVbNa/dtLUZp9VA+zxQo/wmVGON/XdH9i3pGzCzQb+aRr2xW0uEGJAnLQd04URi7skpsX9EhZcc/aPgrOH5A/jacECN1c/6bS/J+ReNoohqaoj0JZB+4sPX71YoaMOgEZz7z9o7qmKQhSC6iH08nLY53kcy+geSMoFxbokFupnrvof5Ck5MHIYucPnuj7EUrB2srAyD',
        'SHA256': 'SHA256:+WoPGFGoQqGMYdT4wc4T8XFr2ounR4dHNfdmNEI9Dfo',
    }
}
{% else %}
SSH_KEYS = {
    'RSA': {
        'fingerprint': '2048 fe:2e:6a:86:f3:41:e7:03:95:ea:9c:7f:75:9c:ce:9d   (RSA)',
        'pubkey': 'pkgs.fedoraproject.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnhQyqu6oY5g01SOEbtrgrlCk3/eoLVZl2oh6c+Xq2oJg5ppPCtvmdWgU9rEltS+jgAYTH3LG4lGd02boMk8mmV5QvzGGRA9HmN991Phm7y4EN5r84A0gibf2O5QzhU2IMBQuOkEMwqZC+wc7pGGFJeXQjzBAVidjacxXtVJyfFOhAIYoHerIYq3VbJrTzEGkHmcJ8o3ZnP8Mt35aBESNsHdIaCOpvZzK1NVHdUHwRGcXIjG6t06mNVG4DVbdpB6xmMbAD5bemPoPVG0oYVs9wmhSHC0LmOZbvv8CDO2Z0DJ8q25FwVlTjo1Eq2A8VJc4LnHTDHZbtDZiKGTo/UMvvQ==',
        'SHA256': 'SHA256:Q12OTyTeOHWlS54dTzy2BNu7wB8UKNf18+7WHIDsORc',
    }
}
{% endif %}

from pagure.mail_logging import ContextInjector, MSG_FORMAT
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'standard': {
            'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
        },
        'email_format': {
            'format': MSG_FORMAT
        }
    },
    'filters': {
        'myfilter': {
            '()': ContextInjector,
        }
    },
    'handlers': {
        'console': {
            'formatter': 'standard',
            'class': 'logging.StreamHandler',
            'stream': 'ext://sys.stdout',
        },
        'email': {
            'level': 'ERROR',
            'formatter': 'email_format',
            'class': 'logging.handlers.SMTPHandler',
            'mailhost': 'bastion',
            'fromaddr': 'pagure@src.fedoraproject.org',
            'toaddrs': 'pingou@pingoured.fr',
            'subject': 'ERROR on pagure - dist-git',
            'filters': ['myfilter'],
        },
    },
    # The root logger configuration; this is a catch-all configuration
    # that applies to all log messages not handled by a different logger
    'root': {
        'level': 'INFO',
        'handlers': ['console', 'email'],
    },
    'loggers': {
        'pagure': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': True
        },
        'flask': {
            'handlers': ['console'],
            'level': 'INFO',
            'propagate': False
        },
        'sqlalchemy': {
            'handlers': ['console'],
            'level': 'WARN',
            'propagate': False
        },
        'binaryornot': {
            'handlers': ['console'],
            'level': 'WARN',
            'propagate': True
        },
        'pagure.lib.encoding_utils': {
            'handlers': ['console'],
            'level': 'WARN',
            'propagate': False
        },
    }
}


# Configuration item that are specific for this odd pagure instance

ENABLE_UI_NEW_PROJECTS = False
ALLOWED_PREFIX = ['rpms', 'modules', 'flatpaks', 'container', 'tests']
EXCLUDE_GROUP_INDEX = ['packager']
PRIVATE_PROJECTS = False
{% if env == 'staging' %}
FEDMSG_NOTIFICATIONS = False
FEDORA_MESSAGING_NOTIFICATIONS = True
{% else %}
FEDMSG_NOTIFICATIONS = True
FEDORA_MESSAGING_NOTIFICATIONS = False
{% endif %}
PR_TARGET_MATCHING_BRANCH = True

ALWAYS_FEDMSG_ON_COMMITS = True

ACLS = {
    'create_branch': 'Create a git branch on a project',
    'create_project': 'Create a new project',
    'fork_project': 'Fork a project',
    'pull_request_create': 'Open a new pull-request',
    'pull_request_close': 'Close a pull-request of this project',
    'pull_request_comment': 'Comment on a pull-request of this project',
    'pull_request_flag': 'Flag a pull-request of this project',
    'pull_request_merge': 'Merge a pull-request of this project',
    'modify_project': 'Modify an existing project',
    'generate_acls_project': 'Generate the Gitolite ACLs on a project',
    'commit_flag': 'Flag a commit',
    "update_watch_status": "Update the watch status on a project",
}

REQUIRED_GROUPS = {
    'container/*': ['packager'],
    'flatpaks/*': ['packager'],
    'modules/*': ['packager'],
    'rpms/*': ['packager'],
}

{% if env == 'staging' %}
RESULTSDB_URL = 'https://taskotron.stg.fedoraproject.org/resultsdb_api/'
FAS_URL = 'https://admin.stg.fedoraproject.org/accounts'
FAS_OPENID_ENDPOINT = 'https://id.stg.fedoraproject.org/openid/'
{% else %}
RESULTSDB_URL = 'https://taskotron.fedoraproject.org/resultsdb_api/'
FAS_URL = 'https://admin.fedoraproject.org/accounts'
{% endif %}

THEME_TEMPLATE_FOLDER = '/usr/share/pagure_dist_git/template/'
THEME = 'srcfpo'

USER_ACLS = [
    'fork_project',
    'pull_request_create',
    'pull_request_close',
    'pull_request_comment',
    'pull_request_flag',
    'pull_request_merge',
    'modify_project',
    'update_watch_status',
]

CROSS_PROJECT_ACLS = [
    'fork_project',
    'modify_project',
    'pull_request_create',
    'pull_request_comment',
    'update_watch_status',
]

ADMIN_API_ACLS = [
    'pull_request_flag',
    'pull_request_comment',
    'pull_request_merge',
    'create_project',
    'modify_project',
    'generate_acls_project',
    'commit_flag',
    'create_branch',
]

PROJECT_NAME_REGEX = '^[a-zA-z0-9_][a-zA-Z0-9-_\.+]*$'

HTTP_REPO_ACCESS_GITOLITE = None

{% include "pagure_shared.cfg" %}