forked from googlearchive/cloud-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
94 lines (69 loc) · 2.57 KB
/
Copy pathsettings.py
File metadata and controls
94 lines (69 loc) · 2.57 KB
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
"""Module containing global playground constants and functions."""
import os
from google.appengine.api import app_identity
from google.appengine.api import backends
from . import appids
DEBUG = True
# user content hostname prefix
USER_CONTENT_PREFIX = 'user-content'
# RFC1113 formatted 'Expires' to prevent HTTP/1.0 caching
LONG_AGO = 'Mon, 01 Jan 1990 00:00:00 GMT'
# 10 minutes
TEMPLATE_MEMCACHE_TIME = 3600
# owners of template projects
PUBLIC_PROJECT_TEMPLATE_OWNER = 'PUBLIC_TEMPLATE'
MANUAL_PROJECT_TEMPLATE_OWNER = 'MANUAL_TEMPLATE'
PROJECT_TEMPLATE_OWNERS = [
PUBLIC_PROJECT_TEMPLATE_OWNER,
MANUAL_PROJECT_TEMPLATE_OWNER
]
# whether or not we're running in the dev_appserver
_DEV_MODE = os.environ['SERVER_SOFTWARE'].startswith('Development/')
# namespace for playground specific data
PLAYGROUND_NAMESPACE = '_playground'
# template projects location
TEMPLATE_PROJECT_DIR = 'repos/'
# project access_key query parameter name
ACCESS_KEY_SET_COOKIE_PARAM_NAME = 'set_access_key_cookie'
ACCESS_KEY_HTTP_HEADER = 'X-Cloud-Playground-Access-Key'
ACCESS_KEY_COOKIE_NAME = 'access_key'
ACCESS_KEY_COOKIE_ARGS = {
'httponly': True,
'secure': not _DEV_MODE,
}
# name for the session cookie
SESSION_COOKIE_NAME = 'session'
SESSION_COOKIE_ARGS = {
'httponly': True,
'secure': not _DEV_MODE,
}
XSRF_COOKIE_ARGS = {
'httponly': False,
'secure': not _DEV_MODE,
}
# One hour
MIN_EXPIRATION_SECONDS = 3600
# One week
DEFAULT_EXPIRATION_SECONDS = 604800
# sentinnel value indicating a missing project
NO_SUCH_PROJECT = 'NO_SUCH_PROJECT'
# Extensions to exclude when creating template projects
SKIP_EXTENSIONS = ('swp', 'pyc', 'svn')
if _DEV_MODE:
PLAYGROUND_HOSTS = ['localhost:8080', '127.0.0.1:8080',
# port 7070 for karma e2e test
'localhost:7070', '127.0.0.1:7070',
app_identity.get_default_version_hostname()]
# PLAYGROUND_USER_CONTENT_HOST = backends.get_hostname('user-content-backend')
PLAYGROUND_USER_CONTENT_HOST = None
MIMIC_HOST = backends.get_hostname('exec-code-backend')
else:
PLAYGROUND_HOSTS = ['{}.appspot.com'.format(appids.PLAYGROUND_APP_ID)]
if appids.PLAYGROUND_APP_ID_ALIAS:
PLAYGROUND_HOSTS.append('{}.appspot.com'
.format(appids.PLAYGROUND_APP_ID_ALIAS))
# PLAYGROUND_USER_CONTENT_HOST = ('{0}-dot-{1}.appspot.com'
# .format(USER_CONTENT_PREFIX,
# appids.PLAYGROUND_APP_ID))
PLAYGROUND_USER_CONTENT_HOST = None
MIMIC_HOST = '{0}.appspot.com'.format(appids.MIMIC_APP_ID)