Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
dacd156e
Commit
dacd156e
authored
10 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
add sensible defaults to various stuffs
parent
d6f783a5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api.wsgi
+3
-3
3 additions, 3 deletions
api.wsgi
core.py
+9
-4
9 additions, 4 deletions
core.py
with
12 additions
and
7 deletions
api.wsgi
+
3
−
3
View file @
dacd156e
...
...
@@ -20,7 +20,7 @@ ap.add_argument('--data_path', help='path to storage area', required=True)
ap.add_argument('--ssl_cert', help='path to SSL certificate file, containing private key and certificate chain', required=True)
ap.add_argument('--api_uri', help='api uri, with https:// prefix')
ap.add_argument('--site_id', help='site ID for Scitran Central [local]', default='local')
ap.add_argument('--site_name', help='site name', nargs='
+'
) # hack for uwsgi --pyargv
ap.add_argument('--site_name', help='site name', nargs='
*', default=['Local']
) # hack for uwsgi --pyargv
ap.add_argument('--oauth2_id_endpoint', help='OAuth2 provider ID endpoint', default='https://www.googleapis.com/plus/v1/people/me/openIdConnect')
ap.add_argument('--demo', help='enable automatic user creation', action='store_true', default=False)
ap.add_argument('--insecure', help='allow user info as urlencoded param', action='store_true', default=False)
...
...
@@ -30,7 +30,7 @@ args = ap.parse_args()
# HACK to allow setting the --site_name in the same way as api.py
# --site_name 'Example Site' or --site_name "Example Site"
args.site_name = ' '.join(args.site_name).strip('"\'')
if args.site_name else args.site_name
args.site_name = ' '.join(args.site_name).strip('"\'')
args.quarantine_path = os.path.join(args.data_path, 'quarantine')
logging.basicConfig(level=getattr(logging, args.log_level.upper())) #FIXME probably not necessary, because done in api.py
...
...
@@ -61,7 +61,7 @@ else:
raise Exception('Could not connect to MongoDB')
# TODO: make api_uri a required arg?
application.db.sites.update({'_id': args.site_id}, {'_id': args.site_id, 'name': args.site_name
or 'Local'
, 'api_uri': args.api_uri
, 'onload': True
}, upsert=True)
application.db.sites.update({'_id': args.site_id}, {'_id': args.site_id, 'name': args.site_name, 'api_uri': args.api_uri}, upsert=True)
if not args.ssl_cert:
log.warning('SSL certificate not specified, Scitran Central functionality disabled')
...
...
This diff is collapsed.
Click to expand it.
core.py
+
9
−
4
View file @
dacd156e
...
...
@@ -185,13 +185,18 @@ class Core(base.RequestHandler):
def
sites
(
self
):
"""
Return local and remote sites.
"""
if
self
.
app
.
config
[
'
site_id
'
]
==
'
local
'
:
return
[
self
.
app
.
db
.
sites
.
find_one
({
'
_id
'
:
'
local
'
},
{
'
_id
'
:
1
,
'
name
'
:
1
,
'
onload
'
:
1
})]
projection
=
[
'
name
'
,
'
onload
'
]
# TODO onload for local is true
if
self
.
public_request
or
self
.
request
.
get
(
'
all
'
).
lower
()
in
(
'
1
'
,
'
true
'
):
sites
=
list
(
self
.
app
.
db
.
sites
.
find
(
None
,
[
'
name
'
]
))
sites
=
list
(
self
.
app
.
db
.
sites
.
find
(
None
,
projection
))
else
:
# TODO onload based on user prefs
remote_ids
=
(
self
.
app
.
db
.
users
.
find_one
({
'
_id
'
:
self
.
uid
},
[
'
remotes
'
])
or
{}).
get
(
'
remotes
'
,
[])
+
[
self
.
app
.
config
[
'
site_id
'
]]
sites
=
list
(
self
.
app
.
db
.
sites
.
find
({
'
_id
'
:
{
'
$in
'
:
remote_ids
}},
[
'
name
'
]))
sites
=
list
(
self
.
app
.
db
.
sites
.
find
({
'
_id
'
:
{
'
$in
'
:
remote_ids
}},
projection
))
for
s
in
sites
:
# TODO: this for loop will eventually move to public case
if
s
[
'
_id
'
]
==
self
.
app
.
config
[
'
site_id
'
]:
s
[
'
onload
'
]
=
True
break
return
sites
search_schema
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment