-
-
Notifications
You must be signed in to change notification settings - Fork 996
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lifecycle: much improved debugging experience (#12804)
* lifecycle: much improved debugging experience Signed-off-by: Jens Langhammer <jens@goauthentik.io> * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add start debug launch configs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only install dev deps in container Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add pathMappings Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use debugger variable to enable only debugger without debug mode enabled Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix path map Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
- Loading branch information
Showing
10 changed files
with
103 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from structlog.stdlib import get_logger | ||
|
||
from authentik.lib.config import CONFIG | ||
|
||
LOGGER = get_logger() | ||
|
||
|
||
def start_debug_server(**kwargs) -> bool: | ||
"""Attempt to start a debugpy server in the current process. | ||
Returns true if the server was started successfully, otherwise false""" | ||
if not CONFIG.get_bool("debug") and not CONFIG.get_bool("debugger"): | ||
return | ||
try: | ||
import debugpy | ||
except ImportError: | ||
LOGGER.warning( | ||
"Failed to import debugpy. debugpy is not included " | ||
"in the default release dependencies and must be installed manually" | ||
) | ||
return False | ||
|
||
listen: str = CONFIG.get("listen.listen_debug_py", "127.0.0.1:9901") | ||
host, _, port = listen.rpartition(":") | ||
debugpy.listen((host, int(port)), **kwargs) # nosec | ||
LOGGER.debug("Starting debug server", host=host, port=port) | ||
return True |
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