Read secrets from YAML configuration, is it possible?

Not sure if this has been asked before but is it possible to read secrets from Lovelace managed through YAML files? :thinking:

I am pushing all my config to a GH repo but right now I have an RTSP URL that is exposing: username, password, and IP address and has no clues on how to store this config without the need to expose them or have them in a public repository.

This is an example of the URL:

'rtsp://username:password@ipaddress:554/stream1'

I tried long time ago, I gave up.
I’ve put the full url in the secrets.yaml file instead.
Like for the MySQL DB

hadb: mysql://homeassistant:[email protected]/homeassistant?charset=utf8mb4

I asked ChatGPT to help just a few minutes ago, spending way too much time trying the stupid solutions this A-“not so”-I provided and at the end, I got this:

I apologize for any frustration or confusion caused. I understand that you have been struggling to find a solution for your specific use case.

If you are still interested in finding a solution, I suggest reaching out to the Home Assistant community forums or the official Discord chat. There, you can ask for help from experienced users and developers who may be able to provide a more specific and detailed solution to your problem.

I wish you the best of luck in finding a resolution to your issue.

are you able to read that var from inside a lovelace YAML file?

Ok, following @Olivier1974 suggestion I tried and it worked. I moved the entire URL to my secrets and then used it in my view:

      - type: custom:webrtc-camera
        url: !secret tapo_camera_stream
        muted: true
        background: true
        shortcuts:
          - name: Record
            icon: mdi:record-circle-outline
            service: switch.toggle
            service_data:
              entity_id: switch.camera_record
        mode: webrtc,mse,mp4,mjpeg

Note: this probably only works for views managed through YAML