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
f52ed486
Commit
f52ed486
authored
9 years ago
by
nagem
Browse files
Options
Downloads
Patches
Plain Diff
Add version endpoint to API
parent
136c2391
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/api.py
+7
-1
7 additions, 1 deletion
api/api.py
api/config.py
+3
-0
3 additions, 0 deletions
api/config.py
bin/database.py
+1
-1
1 addition, 1 deletion
bin/database.py
with
11 additions
and
2 deletions
api/api.py
+
7
−
1
View file @
f52ed486
...
...
@@ -32,6 +32,11 @@ class Config(base.RequestHandler):
'
;
'
)
class
Version
(
base
.
RequestHandler
):
def
get
(
self
):
return
config
.
get_version
()
#regexes used in routing table:
routing_regexes
=
{
# group id regex
...
...
@@ -77,7 +82,8 @@ routes = [
webapp2
.
Route
(
r
'
/sites
'
,
centralclient
.
CentralClient
,
handler_method
=
'
sites
'
,
methods
=
[
'
GET
'
]),
webapp2
.
Route
(
r
'
/register
'
,
centralclient
.
CentralClient
,
handler_method
=
'
register
'
,
methods
=
[
'
POST
'
]),
webapp2
.
Route
(
r
'
/config
'
,
Config
,
methods
=
[
'
GET
'
]),
webapp2
.
Route
(
r
'
/config.js
'
,
Config
,
handler_method
=
'
get_js
'
,
methods
=
[
'
GET
'
])
webapp2
.
Route
(
r
'
/config.js
'
,
Config
,
handler_method
=
'
get_js
'
,
methods
=
[
'
GET
'
]),
webapp2
.
Route
(
r
'
/version
'
,
Version
,
methods
=
[
'
GET
'
]),
]),
webapp2
.
Route
(
r
'
/api/users
'
,
userhandler
.
UserHandler
,
handler_method
=
'
get_all
'
,
methods
=
[
'
GET
'
]),
webapp2
.
Route
(
r
'
/api/users
'
,
userhandler
.
UserHandler
,
methods
=
[
'
POST
'
]),
...
...
This diff is collapsed.
Click to expand it.
api/config.py
+
3
−
0
View file @
f52ed486
...
...
@@ -133,5 +133,8 @@ def get_public_config():
'
auth
'
:
__config
.
get
(
'
auth
'
),
}
def
get_version
():
return
db
.
version
.
find_one
({
"
_id
"
:
"
version
"
},
{
"
_id
"
:
0
})
def
get_item
(
outer
,
inner
):
return
get_config
()[
outer
][
inner
]
This diff is collapsed.
Click to expand it.
bin/database.py
+
1
−
1
View file @
f52ed486
...
...
@@ -8,7 +8,7 @@ CURRENT_DATABASE_VERSION = 1 # An int that is bumped when a new schema change is
def
get_db_version
():
version
=
config
.
db
.
version
.
find_one
({
"
_id
"
:
"
version
"
}
)
version
=
config
.
get_
version
(
)
if
version
is
None
or
version
.
get
(
'
database
'
,
None
)
is
None
:
return
0
else
:
...
...
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