Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- platform/core/store_pg.py +17 -0
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v55",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "9113f9d",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v55",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
9113f9d
|
platform/core/store_pg.py
CHANGED
|
@@ -39,6 +39,7 @@ empty dict gets written back over real data.
|
|
| 39 |
import json
|
| 40 |
import os
|
| 41 |
import threading
|
|
|
|
| 42 |
|
| 43 |
import core.data_binding as data_binding
|
| 44 |
|
|
@@ -137,6 +138,8 @@ PRODUCTION_TENANTS = frozenset({
|
|
| 137 |
#: one it did not name". That is `--data-repo`'s exact failure, which is the failure this file's
|
| 138 |
#: existence is a response to.
|
| 139 |
_SANDBOX_TENANTS_VAR = 'AIOS_SANDBOX_TENANTS'
|
|
|
|
|
|
|
| 140 |
|
| 141 |
|
| 142 |
def sandbox_tenants():
|
|
@@ -145,6 +148,18 @@ def sandbox_tenants():
|
|
| 145 |
return frozenset(s.strip().lower() for s in raw.split(',') if s.strip())
|
| 146 |
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
def write_refusal(tenant_slug=None):
|
| 149 |
"""`None` if this deployment may write this tenant's schema, else the sentence explaining why.
|
| 150 |
|
|
@@ -165,6 +180,8 @@ def write_refusal(tenant_slug=None):
|
|
| 165 |
if data_binding.is_production_deployment():
|
| 166 |
return None # rule 1
|
| 167 |
if slug in PRODUCTION_TENANTS: # rule 2
|
|
|
|
|
|
|
| 168 |
if data_binding.local_override():
|
| 169 |
return None
|
| 170 |
who = data_binding.deployment_id() or 'this machine (no Space identity)'
|
|
|
|
| 39 |
import json
|
| 40 |
import os
|
| 41 |
import threading
|
| 42 |
+
from urllib.parse import urlparse
|
| 43 |
|
| 44 |
import core.data_binding as data_binding
|
| 45 |
|
|
|
|
| 138 |
#: one it did not name". That is `--data-repo`'s exact failure, which is the failure this file's
|
| 139 |
#: existence is a response to.
|
| 140 |
_SANDBOX_TENANTS_VAR = 'AIOS_SANDBOX_TENANTS'
|
| 141 |
+
_ISOLATED_DATABASE_HOST_VAR = 'AIOS_ISOLATED_DATABASE_HOST'
|
| 142 |
+
_STAGING_SPACE = 'fsanyoto/loopable'
|
| 143 |
|
| 144 |
|
| 145 |
def sandbox_tenants():
|
|
|
|
| 148 |
return frozenset(s.strip().lower() for s in raw.split(',') if s.strip())
|
| 149 |
|
| 150 |
|
| 151 |
+
def isolated_staging_database():
|
| 152 |
+
"""Whether this process is staging on the exact isolated database host it was handed."""
|
| 153 |
+
if data_binding.deployment_id() != _STAGING_SPACE:
|
| 154 |
+
return False
|
| 155 |
+
allowed_host = str(os.environ.get(_ISOLATED_DATABASE_HOST_VAR) or '').strip().lower()
|
| 156 |
+
try:
|
| 157 |
+
current_host = (urlparse(str(os.environ.get('DATABASE_URL') or '')).hostname or '').lower()
|
| 158 |
+
except ValueError:
|
| 159 |
+
return False
|
| 160 |
+
return bool(allowed_host and current_host == allowed_host)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
def write_refusal(tenant_slug=None):
|
| 164 |
"""`None` if this deployment may write this tenant's schema, else the sentence explaining why.
|
| 165 |
|
|
|
|
| 180 |
if data_binding.is_production_deployment():
|
| 181 |
return None # rule 1
|
| 182 |
if slug in PRODUCTION_TENANTS: # rule 2
|
| 183 |
+
if slug in sandbox_tenants() and isolated_staging_database():
|
| 184 |
+
return None
|
| 185 |
if data_binding.local_override():
|
| 186 |
return None
|
| 187 |
who = data_binding.deployment_id() or 'this machine (no Space identity)'
|