mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-25 12:14:32 -04: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,
|
ConfigDefaultDict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
### Pre-Fetch Minimal System Config
|
||||||
|
|
||||||
SYSTEM_USER = getpass.getuser() or os.getlogin()
|
SYSTEM_USER = getpass.getuser() or os.getlogin()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -58,6 +61,13 @@ except ModuleNotFoundError:
|
||||||
# pwd is only needed for some linux systems, doesn't exist on windows
|
# pwd is only needed for some linux systems, doesn't exist on windows
|
||||||
pass
|
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 ##################################
|
||||||
|
|
||||||
CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
|
CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
|
||||||
|
@ -805,6 +815,7 @@ def get_data_locations(config: ConfigDict) -> ConfigValue:
|
||||||
'path': config['OUTPUT_DIR'].resolve(),
|
'path': config['OUTPUT_DIR'].resolve(),
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'is_valid': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).exists(),
|
'is_valid': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).exists(),
|
||||||
|
'is_mount': os.path.ismount(OUTPUT_DIR),
|
||||||
},
|
},
|
||||||
'SOURCES_DIR': {
|
'SOURCES_DIR': {
|
||||||
'path': config['SOURCES_DIR'].resolve(),
|
'path': config['SOURCES_DIR'].resolve(),
|
||||||
|
@ -820,6 +831,7 @@ def get_data_locations(config: ConfigDict) -> ConfigValue:
|
||||||
'path': config['ARCHIVE_DIR'].resolve(),
|
'path': config['ARCHIVE_DIR'].resolve(),
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'is_valid': config['ARCHIVE_DIR'].exists(),
|
'is_valid': config['ARCHIVE_DIR'].exists(),
|
||||||
|
'is_mount': os.path.ismount(ARCHIVE_DIR),
|
||||||
},
|
},
|
||||||
'CONFIG_FILE': {
|
'CONFIG_FILE': {
|
||||||
'path': config['CONFIG_FILE'].resolve(),
|
'path': config['CONFIG_FILE'].resolve(),
|
||||||
|
@ -830,6 +842,7 @@ def get_data_locations(config: ConfigDict) -> ConfigValue:
|
||||||
'path': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).resolve(),
|
'path': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).resolve(),
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
'is_valid': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).exists(),
|
'is_valid': (config['OUTPUT_DIR'] / SQL_INDEX_FILENAME).exists(),
|
||||||
|
'is_mount': os.path.ismount(config['OUTPUT_DIR'] / SQL_INDEX_FILENAME),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue