karrio-server 2026.1.3__py3-none-any.whl → 2026.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
karrio/server/VERSION CHANGED
@@ -1 +1 @@
1
- 2026.1.3
1
+ 2026.1.5
@@ -513,6 +513,15 @@ SIMPLE_JWT = {
513
513
  "SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=1),
514
514
  }
515
515
 
516
+ # JWT Cookie settings for HTTP-only cookie authentication
517
+ JWT_AUTH_COOKIE = config("JWT_AUTH_COOKIE", default="karrio_access_token")
518
+ JWT_REFRESH_COOKIE = config("JWT_REFRESH_COOKIE", default="karrio_refresh_token")
519
+ JWT_AUTH_COOKIE_SECURE = config(
520
+ "JWT_AUTH_COOKIE_SECURE", default=USE_HTTPS, cast=bool
521
+ )
522
+ JWT_AUTH_COOKIE_SAMESITE = config("JWT_AUTH_COOKIE_SAMESITE", default="Lax")
523
+ JWT_AUTH_COOKIE_PATH = config("JWT_AUTH_COOKIE_PATH", default="/")
524
+
516
525
  # OAuth2 config
517
526
  OIDC_RSA_PRIVATE_KEY = config("OIDC_RSA_PRIVATE_KEY", default="").replace("\\n", "\n")
518
527
  OAUTH2_PROVIDER_APPLICATION_MODEL = "oauth2_provider.Application"
@@ -1,5 +1,6 @@
1
1
  # type: ignore
2
2
  import sys
3
+ import socket
3
4
  from decouple import config
4
5
  from karrio.server.settings.base import *
5
6
  from karrio.server.settings.apm import HEALTH_CHECK_APPS
@@ -8,6 +9,10 @@ from karrio.server.core.logging import logger
8
9
 
9
10
  CACHE_TTL = 60 * 15
10
11
 
12
+ # Health check cache key - make it unique per pod to avoid race conditions
13
+ # Use hostname (pod name in k8s) as suffix to prevent conflicts between replicas
14
+ HEALTHCHECK_CACHE_KEY = f"djangohealthcheck_{socket.gethostname()}"
15
+
11
16
  # Check if worker is running in detached mode (separate from API server)
12
17
  DETACHED_WORKER = config("DETACHED_WORKER", default=False, cast=bool)
13
18
 
@@ -32,7 +37,7 @@ if REDIS_URL is not None:
32
37
 
33
38
  # Extract values from REDIS_URL (these supersede granular env vars)
34
39
  REDIS_HOST = parsed.hostname
35
- REDIS_PORT = parsed.port or 6379
40
+ REDIS_PORT = parsed.port or 10000 # Azure Managed Redis default port
36
41
  REDIS_USERNAME = parsed.username or "default"
37
42
  REDIS_PASSWORD = parsed.password
38
43
 
@@ -40,9 +45,10 @@ if REDIS_URL is not None:
40
45
  REDIS_SCHEME = parsed.scheme if parsed.scheme in ("redis", "rediss") else "redis"
41
46
  REDIS_SSL = REDIS_SCHEME == "rediss"
42
47
 
43
- # Build connection URL with database 1 for cache
48
+ # Build connection URL for cache (use DB from URL path, default to 0)
49
+ REDIS_DB = parsed.path.lstrip("/") or "0"
44
50
  REDIS_AUTH = f"{REDIS_USERNAME}:{REDIS_PASSWORD}@" if REDIS_PASSWORD else ""
45
- REDIS_CONNECTION_URL = f"{REDIS_SCHEME}://{REDIS_AUTH}{REDIS_HOST}:{REDIS_PORT}/1"
51
+ REDIS_CONNECTION_URL = f"{REDIS_SCHEME}://{REDIS_AUTH}{REDIS_HOST}:{REDIS_PORT}/{REDIS_DB}"
46
52
 
47
53
  else:
48
54
  # Fall back to individual parameters
@@ -52,10 +58,11 @@ else:
52
58
  REDIS_USERNAME = config("REDIS_USERNAME", default="default")
53
59
 
54
60
  if REDIS_HOST is not None:
61
+ REDIS_DB = config("REDIS_CACHE_DB", default="0")
55
62
  REDIS_AUTH = f"{REDIS_USERNAME}:{REDIS_PASSWORD}@" if REDIS_PASSWORD else ""
56
63
  REDIS_SCHEME = "rediss" if REDIS_SSL else "redis"
57
64
  REDIS_CONNECTION_URL = (
58
- f'{REDIS_SCHEME}://{REDIS_AUTH}{REDIS_HOST}:{REDIS_PORT or "6379"}/1'
65
+ f'{REDIS_SCHEME}://{REDIS_AUTH}{REDIS_HOST}:{REDIS_PORT or "6379"}/{REDIS_DB}'
59
66
  )
60
67
 
61
68
  # Configure Django cache if Redis is available and not in worker mode
@@ -38,7 +38,7 @@ if REDIS_URL is not None:
38
38
 
39
39
  # Extract values from REDIS_URL (these supersede granular env vars)
40
40
  REDIS_HOST = parsed.hostname
41
- REDIS_PORT = parsed.port or 6379
41
+ REDIS_PORT = parsed.port or 10000 # Azure Managed Redis default port
42
42
  REDIS_USERNAME = parsed.username or "default"
43
43
  REDIS_PASSWORD = parsed.password
44
44