mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-23 02:10:14 +00:00
move ES_SNAPSHOT_DIR to EnvironmentSettings
This commit is contained in:
parent
64ffc18da7
commit
2826ca4a43
@ -3,12 +3,12 @@ Functionality:
|
|||||||
- check that all connections are working
|
- check that all connections are working
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from os import environ
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from home.src.es.connect import ElasticWrap
|
from home.src.es.connect import ElasticWrap
|
||||||
|
from home.src.ta.settings import EnvironmentSettings
|
||||||
from home.src.ta.ta_redis import RedisArchivist
|
from home.src.ta.ta_redis import RedisArchivist
|
||||||
|
|
||||||
TOPIC = """
|
TOPIC = """
|
||||||
@ -156,10 +156,8 @@ class Command(BaseCommand):
|
|||||||
" 🗙 path.repo env var not found. "
|
" 🗙 path.repo env var not found. "
|
||||||
+ "set the following env var to the ES container:\n"
|
+ "set the following env var to the ES container:\n"
|
||||||
+ " path.repo="
|
+ " path.repo="
|
||||||
+ environ.get(
|
+ EnvironmentSettings.ES_SNAPSHOT_DIR
|
||||||
"ES_SNAPSHOT_DIR", "/usr/share/elasticsearch/data/snapshot"
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
self.stdout.write(self.style.ERROR(f"{message}"))
|
self.stdout.write(self.style.ERROR(message))
|
||||||
sleep(60)
|
sleep(60)
|
||||||
raise CommandError(message)
|
raise CommandError(message)
|
||||||
|
@ -4,7 +4,6 @@ functionality:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os import environ
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
@ -20,9 +19,7 @@ class ElasticSnapshot:
|
|||||||
REPO_SETTINGS = {
|
REPO_SETTINGS = {
|
||||||
"compress": "true",
|
"compress": "true",
|
||||||
"chunk_size": "1g",
|
"chunk_size": "1g",
|
||||||
"location": environ.get(
|
"location": EnvironmentSettings.ES_SNAPSHOT_DIR,
|
||||||
"ES_SNAPSHOT_DIR", "/usr/share/elasticsearch/data/snapshot"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
POLICY = "ta_daily"
|
POLICY = "ta_daily"
|
||||||
|
|
||||||
|
@ -37,6 +37,11 @@ class EnvironmentSettings:
|
|||||||
ES_URL: str = str(environ.get("ES_URL"))
|
ES_URL: str = str(environ.get("ES_URL"))
|
||||||
ES_PASS: str = str(environ.get("ELASTIC_PASSWORD"))
|
ES_PASS: str = str(environ.get("ELASTIC_PASSWORD"))
|
||||||
ES_USER: str = str(environ.get("ELASTIC_USER", "elastic"))
|
ES_USER: str = str(environ.get("ELASTIC_USER", "elastic"))
|
||||||
|
ES_SNAPSHOT_DIR: str = str(
|
||||||
|
environ.get(
|
||||||
|
"ES_SNAPSHOT_DIR", "/usr/share/elasticsearch/data/snapshot"
|
||||||
|
)
|
||||||
|
)
|
||||||
ES_DISABLE_VERIFY_SSL: bool = bool(environ.get("ES_DISABLE_VERIFY_SSL"))
|
ES_DISABLE_VERIFY_SSL: bool = bool(environ.get("ES_DISABLE_VERIFY_SSL"))
|
||||||
|
|
||||||
def print_generic(self):
|
def print_generic(self):
|
||||||
@ -78,6 +83,7 @@ class EnvironmentSettings:
|
|||||||
ES_URL: {self.ES_URL}
|
ES_URL: {self.ES_URL}
|
||||||
ES_PASS: *****
|
ES_PASS: *****
|
||||||
ES_USER: {self.ES_USER}
|
ES_USER: {self.ES_USER}
|
||||||
|
ES_SNAPSHOT_DIR: {self.ES_SNAPSHOT_DIR}
|
||||||
ES_DISABLE_VERIFY_SSL: {self.ES_DISABLE_VERIFY_SSL}"""
|
ES_DISABLE_VERIFY_SSL: {self.ES_DISABLE_VERIFY_SSL}"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user