Using Environment Variables in Configuration Pipelines

In my case, I was able to add env to /etc/default/alloy

~# cat /etc/default/alloy 
---
## Path:
## Description: Grafana Alloy settings
## Type:        string
## Default:     ""
## ServiceRestart: alloy
#
# Command line options for Alloy.
#
# The configuration file holding the Alloy config.
CONFIG_FILE="/etc/alloy/config.alloy"

# User-defined arguments to pass to the run command.
CUSTOM_ARGS="--disable-reporting"

# Defined cloud config for cloud grafana
GRAFANA_CLOUD_URL="https://mydomain.grafana.net/api/prom/push"
GRAFANA_CLOUD_USERNAME="123456"
GRAFANA_CLOUD_TOKEN="glc_<REDACTED>"

# Restart on system upgrade. Defaults to true.
RESTART_ON_UPGRADE=true

My env is: Linux debian 13

~# cat /etc/alloy/config.alloy
---
prometheus.remote_write "grafanacloud" {
  endpoint {
    url = sys.env("GRAFANA_CLOUD_URL")

    basic_auth {
      username = sys.env("GRAFANA_CLOUD_USERNAME")
      password = sys.env("GRAFANA_CLOUD_TOKEN")
    }
  }
}