Skip to content
Snippets Groups Projects
Commit db6760bb authored by Simon Künzel's avatar Simon Künzel
Browse files

Add server name

parent 8af4d986
No related branches found
No related tags found
No related merge requests found
Pipeline #5883 passed
# Specification of the Web API for the Video-AG Website (v0.50). # Specification of the Web API for the Video-AG Website (v0.51).
## Introduction ## Introduction
...@@ -67,10 +67,11 @@ This may be used even if the site is read-only or disabled. ...@@ -67,10 +67,11 @@ This may be used even if the site is read-only or disabled.
###### Response: ###### Response:
| Field | Type | Notes | | Field | Type | Notes |
|-----------------|----------------------------------------|---------------------------------------------------------| |-----------------|-----------------------------------------|---------------------------------------------------------|
| status | id_string | possible values: `available`, `readonly`, `unavailable` | | status | id_string | possible values: `available`, `readonly`, `unavailable` |
| is_debug | boolean | | | is_debug | boolean | |
| git_commit_hash | ?string | | | git_commit_hash | ?string | |
| server_name | string | Name of the server which is answering the request |
| announcements | array of [announcement](#announcement) | | | announcements | array of [announcement](#announcement) | |
<details> <details>
...@@ -1519,6 +1520,10 @@ Possible `error_code`: ...@@ -1519,6 +1520,10 @@ Possible `error_code`:
## Changelog ## Changelog
### v0.51
* Added `server_name` to `GET /status`
### v0.50 ### v0.50
* Removed `GET /announcements` * Removed `GET /announcements`
......
# Defaults for development, do not use in production! # Defaults for development, do not use in production!
DEBUG = True DEBUG = True
# Name of this instance
SERVER_NAME = "dev"
# Prefix which is prepended to paths (which are saved in the database) before they are provided by the api # Prefix which is prepended to paths (which are saved in the database) before they are provided by the api
# Must include the last / # Must include the last /
FILE_PATH_PREFIX = "https://video.fsmpi.rwth-aachen.de/files/" FILE_PATH_PREFIX = "https://video.fsmpi.rwth-aachen.de/files/"
......
...@@ -11,6 +11,8 @@ _GIT_COMMIT_HASH = os.environ.get("VIDEOAG_API_GIT_COMMIT_HASH", None) ...@@ -11,6 +11,8 @@ _GIT_COMMIT_HASH = os.environ.get("VIDEOAG_API_GIT_COMMIT_HASH", None)
if _GIT_COMMIT_HASH is not None and len(_GIT_COMMIT_HASH) == 0: if _GIT_COMMIT_HASH is not None and len(_GIT_COMMIT_HASH) == 0:
_GIT_COMMIT_HASH = None _GIT_COMMIT_HASH = None
_SERVER_NAME = api.config["SERVER_NAME"]
@api_route("/status", ["GET"], allow_while_readonly=True, allow_while_disabled=True) @api_route("/status", ["GET"], allow_while_readonly=True, allow_while_disabled=True)
def api_route_status(): def api_route_status():
...@@ -31,6 +33,7 @@ def api_route_status(): ...@@ -31,6 +33,7 @@ def api_route_status():
response = { response = {
"status": status, "status": status,
"is_debug": DEBUG_ENABLED, "is_debug": DEBUG_ENABLED,
"server_name": _SERVER_NAME,
"announcements": announcements "announcements": announcements
} }
if _GIT_COMMIT_HASH is not None: if _GIT_COMMIT_HASH is not None:
......
...@@ -12,6 +12,7 @@ class SiteTest(ApiTest): ...@@ -12,6 +12,7 @@ class SiteTest(ApiTest):
None, None,
{ {
"status": "available", "status": "available",
"server_name": "dev",
"announcements": [ "announcements": [
TEST_DATA_ANNOUNCEMENT_1, TEST_DATA_ANNOUNCEMENT_1,
TEST_DATA_ANNOUNCEMENT_2 TEST_DATA_ANNOUNCEMENT_2
...@@ -26,6 +27,7 @@ class SiteTest(ApiTest): ...@@ -26,6 +27,7 @@ class SiteTest(ApiTest):
None, None,
{ {
"status": "available", "status": "available",
"server_name": "dev",
"announcements": [ "announcements": [
TEST_DATA_ANNOUNCEMENT_1_MOD, TEST_DATA_ANNOUNCEMENT_1_MOD,
TEST_DATA_ANNOUNCEMENT_2_MOD, TEST_DATA_ANNOUNCEMENT_2_MOD,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment