Skip to content

Commit ab88156

Browse files
committed
Add NOT_SECURED and newrelic stub
Set NOT_SECURED=true in postiz install script for local/non-secured setups. In simplelogin install, detect the venv site-packages path and create a minimal newrelic package stub (newrelic/__init__.py and newrelic/agent.py) with no-op record_custom_event and initialize functions to avoid import errors when New Relic is not present.
1 parent 04dea4d commit ab88156

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

install/postiz-install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ MAIN_URL=http://${LOCAL_IP}
4545
FRONTEND_URL=http://${LOCAL_IP}
4646
NEXT_PUBLIC_BACKEND_URL=http://${LOCAL_IP}/api
4747
BACKEND_INTERNAL_URL=http://localhost:3000
48+
NOT_SECURED=true
4849
TEMPORAL_ADDRESS=localhost:7233
4950
IS_GENERAL=true
5051
STORAGE_PROVIDER=local

install/simplelogin-install.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ $STD uv venv
4444
$STD uv pip install setuptools hatchling editables
4545
$STD uv sync --locked --no-dev --no-build-isolation --no-install-package newrelic
4646

47+
VENV_SITE=$(/opt/simplelogin/.venv/bin/python -c "import site; print(site.getsitepackages()[0])")
48+
mkdir -p "${VENV_SITE}/newrelic"
49+
cat <<'STUB' >"${VENV_SITE}/newrelic/__init__.py"
50+
STUB
51+
cat <<'STUB' >"${VENV_SITE}/newrelic/agent.py"
52+
def record_custom_event(*a, **kw): pass
53+
def initialize(*a, **kw): pass
54+
STUB
55+
4756
if [[ -f /opt/simplelogin/static/package.json ]]; then
4857
cd /opt/simplelogin/static
4958
$STD npm ci || $STD npm install

0 commit comments

Comments
 (0)