-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chg: [website] Harmonization of the documentation with interoperabili…
…ty with former endpoints.
- Loading branch information
1 parent
6f38ccf
commit 7cf074a
Showing
13 changed files
with
176 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from typing import Any | ||
|
||
import logging | ||
from flask_restx import Namespace # type: ignore[import-untyped] | ||
from flask_restx import Resource | ||
|
||
from vulnerabilitylookup import __version__ | ||
from vulnerabilitylookup.default import get_config | ||
from website.web.bootstrap import application | ||
from website.web.bootstrap import vulnerabilitylookup | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
local_instance_name = get_config("generic", "local_instance_name").lower() | ||
local_instance_vulnid_pattern = get_config("generic", "local_instance_vulnid_pattern") | ||
|
||
system_ns = Namespace("system", description="Get the status of the system.") | ||
|
||
|
||
@system_ns.route("/system/redis_up") | ||
@system_ns.doc(description="Check if redis is up and running") | ||
class RedisUp(Resource): # type: ignore[misc] | ||
def get(self) -> bool: | ||
return vulnerabilitylookup.check_redis_up() | ||
|
||
|
||
@system_ns.route("/system/dbInfo") | ||
@system_ns.route( | ||
"/dbInfo", | ||
doc={ | ||
"description": "Alias for /api/sytem/dbInfo", | ||
"deprecated": True, | ||
}, | ||
) | ||
@system_ns.doc( | ||
description="Get more information about the current databases in use and when it was updated" | ||
) | ||
class Info(Resource): # type: ignore[misc] | ||
def get(self) -> dict[str, Any]: | ||
return vulnerabilitylookup.get_info() | ||
|
||
|
||
@system_ns.route("/system/configInfo") | ||
@system_ns.doc( | ||
description="Get non-sensitive information about the configuration of the system." | ||
) | ||
class ConfigInfo(Resource): # type: ignore[misc] | ||
def get(self) -> dict[str, Any]: | ||
return { | ||
"user_accounts": get_config("generic", "user_accounts"), | ||
"local_instance_uuid": get_config("generic", "local_instance_uuid"), | ||
"registration": application.config["SELF_REGISTRATION"], | ||
"moderation": application.config["COMMENTS_MODERATION"], | ||
"software_version": __version__, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.