forked from googlearchive/cloud-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappids.py
More file actions
51 lines (36 loc) · 1.29 KB
/
Copy pathappids.py
File metadata and controls
51 lines (36 loc) · 1.29 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
"""Module which defines collaborating app ids.
This module is used by:
settings.py
scripts/deploy.sh
"""
import os
# List of (playground appid, mimic app id, playground app id alias)
_APP_ID_TUPLES = [
# production environment
('try-appengine', 'shared-playground', 'cloud-playground'),
# development environment
('fredsa-bliss', 'fredsa-hr', None),
('dansanderson-bliss', 'dansanderson-mimic', None),
]
def _GetTupleFor(app_id):
for app_ids in _APP_ID_TUPLES:
if app_id in app_ids:
return app_ids
return (app_id, app_id, None)
# Our app id
_APP_ID = os.environ['APPLICATION_ID'].split('~')[-1]
# support regular 'appspot.com' app ids only
assert ':' not in _APP_ID, ('{} app ids are unsupported'
.format(_APP_ID.split(':')[0]))
app_ids = _GetTupleFor(_APP_ID)
# The application where the playground IDE runs
PLAYGROUND_APP_ID = app_ids[0]
# The application where user code runs
MIMIC_APP_ID = app_ids[1]
# The application alias where the playground IDE runs
PLAYGROUND_APP_ID_ALIAS = app_ids[2]
# Whether we're using two collaborating app ids
TWO_COLLABORATING_APP_IDS = PLAYGROUND_APP_ID != MIMIC_APP_ID
def PrintAppIds():
"""Prints a new line delimited list of known app ids."""
print '\n'.join(set((PLAYGROUND_APP_ID, MIMIC_APP_ID)))