Can't get render hostname into flask app

I’m trying to set the env variable like so in render.yaml but it is not getting set for some reason
I typically set this in the .env. I tried adding this as a singular env also but that also doesn’t get picked up my app for some reason. any ideas ? This repo is github : tronbyt/server

services:
- type: web
  name: tronbyt-server
  runtime: image
  image:
    url: ghcr.io/tronbyt/server:latest
  plan: free
  envVars:
  - key: SERVER_HOSTNAME_OR_IP
    Value: ${RENDER_EXTERNAL_HOSTNAME}
    sync: false
  region: oregon
  autoDeployTrigger: commit
version: "1"

well i got it to do this at least : http://${RENDER_EXTERNAL_HOSTNAME}:8000/6f1276fd/next
ok so i can get it to work by pasting in the literal hostname but the RENDER_EXTERNAL_HOSTNAME var doesn’t seem to work either in the singular env or the blueprint.

ok sync: false basically nullified my blueprint envs, removed and at least it’s trying but still geting this : http://RENDER_EXTERNAL_HOSTNAME/38d9e184/next


services:
- type: web
  name: tronbyt-server
  runtime: image
  image:
    url: ghcr.io/tronbyt/server:latest
  plan: free
  envVars:
  - key: SERVER_HOSTNAME
    value: RENDER_EXTERNAL_HOSTNAME # also tried with ${RENDER_EXTERNAL_HOSTNAME}
  - key: SERVER_PORT
    value: 80
  region: oregon
  autoDeployTrigger: commit
version: "1"

Ok, got it work by referencing itself as a service :

# Exported from Render on 2025-07-18T20:59:40Z
services:
- type: web
  name: tronbyt-server
  runtime: image
  image:
    url: ghcr.io/tronbyt/server:latest
  plan: free
  envVars:
  - key: SERVER_HOSTNAME
    fromService:
      name: tronbyt-server
      type: web
      envVarKey: RENDER_EXTERNAL_HOSTNAME
  - key: SERVER_PORT
    value: 80
  region: oregon
  autoDeployTrigger: commit
version: "1"

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.