diff --git a/.env.example b/.env.example index 499c252..c09149d 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,13 @@ EMAIL=YOUR@email.here SITE_ADDRESS=localhost # Your Domain here -LOG_LEVEL=30 +LOG_LEVEL=0 #10 Debug 20 Info 30 Warn POSTGRES_DB=gatus POSTGRES_USER=username POSTGRES_PASSWORD=password - POSTGRES_HOSTNAME_GATUS=gatusdb POSTGRES_HOSTNAME_MONITORING=monitoringdb POSTGRES_DB_MONITORING=postgres +TEST_MODE=1 +NUMBER_OF_SERVERS=50 diff --git a/cloud-init.yaml.example b/cloud-init.yaml.example index d636172..5bccfe4 100644 --- a/cloud-init.yaml.example +++ b/cloud-init.yaml.example @@ -10,6 +10,7 @@ write_files: POSTGRES_HOSTNAME_GATUS=gatusdb POSTGRES_HOSTNAME_MONITORING=monitoringdb POSTGRES_DB_MONITORING=postgres + NUMBER_OF_SERVERS=50 - path: /root/Caddyfile content: | diff --git a/fedi_gatus/shared/db.py b/fedi_gatus/shared/db.py index 25ee299..4ac2dc2 100644 --- a/fedi_gatus/shared/db.py +++ b/fedi_gatus/shared/db.py @@ -72,10 +72,15 @@ def __init__(self, *args, **kwargs): def get_single_record(self) -> dict: return self.select().get() - def get_top_lemmy_instances(self, count=25) -> list[Model]: - # TODO Add env var for count + def get_top_lemmy_instances(self) -> list[Model]: + NUMBER_OF_SERVERS = int(os.getenv("NUMBER_OF_SERVERS")) logging.info("Number of Rows:" + str(DbAccess.select().count())) - d = DbAccess.select().where(DbAccess.software_name == "Lemmy").order_by(DbAccess.stats_monthly_active_users).limit(count) + d = ( + DbAccess.select() + .where(DbAccess.software_name == "Lemmy") + .order_by(DbAccess.stats_monthly_active_users) + .limit(NUMBER_OF_SERVERS) + ) info = [] for i in d: info.append(i)