add options to disable cron jobs

This commit is contained in:
Her Email 2023-11-22 20:55:45 -05:00 committed by Henri Dickson
parent 382558b50d
commit 82e7bd5824
3 changed files with 10 additions and 2 deletions

View file

@ -66,6 +66,8 @@ env = environ.FileAwareEnv(
NEODB_DOWNLOADER_CACHE_TIMEOUT=(int, 300),
# Number of retries of downloader, when site is using RetryDownloader
NEODB_DOWNLOADER_RETRIES=(int, 3),
# Disable cron jobs
NEODB_DISABLE_CRON=(bool, False),
# INTEGRATED TAKAHE CONFIGURATION
TAKAHE_DB_URL=(str, "postgres://takahe:takahepass@127.0.0.1:5432/takahe"),
# Spotify - https://developer.spotify.com/
@ -220,6 +222,8 @@ DOWNLOADER_REQUEST_TIMEOUT = env("NEODB_DOWNLOADER_REQUEST_TIMEOUT")
DOWNLOADER_CACHE_TIMEOUT = env("NEODB_DOWNLOADER_CACHE_TIMEOUT")
DOWNLOADER_RETRIES = env("NEODB_DOWNLOADER_RETRIES")
DISABLE_CRON = env("NEODB_DISABLE_CRON")
# ====== USER CONFIGUTRATION END ======
DATABASE_ROUTERS = ["takahe.db_routes.TakaheRouter"]
@ -502,7 +506,7 @@ DEVELOPER_CONSOLE_APPLICATION_CLIENT_ID = "NEODB_DEVELOPER_CONSOLE"
# CORS_ALLOWED_ORIGINS = []
# CORS_ALLOWED_ORIGIN_REGEXES = []
CORS_ALLOW_ALL_ORIGINS = True
CORS_URLS_REGEX = r"^/api/.*$"
CORS_URLS_REGEX = r"^/(api|nodeinfo)/.*$"
CORS_ALLOW_METHODS = (
"DELETE",
"GET",

View file

@ -152,6 +152,9 @@ class Setup:
Indexer.init()
# Register cron jobs if not yet
JobManager.schedule_all()
if settings.DISABLE_CRON:
logger.info("Cron jobs are disabled.")
else:
JobManager.schedule_all()
logger.info("Finished post-migration setup.")

View file

@ -30,6 +30,7 @@ x-shared:
NEODB_LOGIN_MASTODON_WHITELIST:
NEODB_MASTODON_CLIENT_SCOPE:
NEODB_DISABLE_DEFAULT_RELAY:
NEODB_DISABLE_CRON:
NEODB_SENTRY_DSN:
TAKAHE_SENTRY_DSN:
NEODB_DB_URL: postgres://neodb:aubergine@neodb-db/neodb