This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2020-12-05 21:08:42 +00:00
|
|
|
"""authentik"""
|
2022-01-13 16:47:31 +00:00
|
|
|
from os import environ
|
|
|
|
from typing import Optional
|
|
|
|
|
2023-07-06 16:15:11 +00:00
|
|
|
__version__ = "2023.4.3"
|
2021-03-16 13:42:01 +00:00
|
|
|
ENV_GIT_HASH_KEY = "GIT_BUILD_HASH"
|
2022-01-13 16:47:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_build_hash(fallback: Optional[str] = None) -> str:
|
|
|
|
"""Get build hash"""
|
2022-05-19 18:50:28 +00:00
|
|
|
build_hash = environ.get(ENV_GIT_HASH_KEY, fallback if fallback else "")
|
2023-01-04 21:26:55 +00:00
|
|
|
return fallback if build_hash == "" and fallback else build_hash
|
2022-01-13 16:47:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_full_version() -> str:
|
|
|
|
"""Get full version, with build hash appended"""
|
|
|
|
version = __version__
|
|
|
|
if (build_hash := get_build_hash()) != "":
|
|
|
|
version += "." + build_hash
|
|
|
|
return version
|