mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
add is_mount and COMMIT_HASH to config.py
This commit is contained in:
parent
375ba9d135
commit
c78a2edc42
1 changed files with 13 additions and 0 deletions
|
@ -49,6 +49,9 @@ from .config_stubs import (
|
|||
ConfigDefaultDict,
|
||||
)
|
||||
|
||||
|
||||
### Pre-Fetch Minimal System Config
|
||||
|
||||
SYSTEM_USER = getpass.getuser() or os.getlogin()
|
||||
|
||||
try:
|
||||
|
@ -58,6 +61,13 @@ except ModuleNotFoundError:
|
|||
# pwd is only needed for some linux systems, doesn't exist on windows
|
||||
pass
|
||||
|
||||
COMMIT_HASH = None
|
||||
try:
|
||||
COMMIT_HASH = list((PACKAGE_DIR / '../.git/refs/heads/').glob('*'))[0].read_text().strip()
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
############################### Config Schema ##################################
|
||||
|
||||
CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
|
||||
|
@ -805,6 +815,7 @@ def get_data_locations(config: ConfigDict) -> ConfigValue:
|
|||
'path': config['OUTPUT_DIR'].resolve(),
|
||||
'enabled': True,
|
||||
'is_valid': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).exists(),
|
||||
'is_mount': os.path.ismount(OUTPUT_DIR),
|
||||
},
|
||||
'SOURCES_DIR': {
|
||||
'path': config['SOURCES_DIR'].resolve(),
|
||||
|
@ -820,6 +831,7 @@ def get_data_locations(config: ConfigDict) -> ConfigValue:
|
|||
'path': config['ARCHIVE_DIR'].resolve(),
|
||||
'enabled': True,
|
||||
'is_valid': config['ARCHIVE_DIR'].exists(),
|
||||
'is_mount': os.path.ismount(ARCHIVE_DIR),
|
||||
},
|
||||
'CONFIG_FILE': {
|
||||
'path': config['CONFIG_FILE'].resolve(),
|
||||
|
@ -830,6 +842,7 @@ def get_data_locations(config: ConfigDict) -> ConfigValue:
|
|||
'path': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).resolve(),
|
||||
'enabled': True,
|
||||
'is_valid': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).exists(),
|
||||
'is_mount': os.path.ismount(config['OUTPUT_DIR'] / SQL_INDEX_FILENAME),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue