Skip to content

[Bug]: env var with $ parsing #3946

@iiAku

Description

@iiAku

Error Message and Logs

Hello

Thanks for building Coolify.

I've tried to install https://github.com/wg-easy/wg-easy through a docker-compose.
To secure the installation it requires a PASSWORD_HASH which is a bcrypt hash so for instance:


❯ docker run -it ghcr.io/wg-easy/wg-easy wgpw foobar                        
PASSWORD_HASH='$2a$12$mSNGEiOT7urQP/Xs10XzPurl5cmVj6tavHRZQUK0jIFXRWFBGmssu'

However I never been able to set that environment variable properly, it seems there is a bug.

For instance if you:

  1. Uncheck Escape special characters in labels?
  2. Double all the $ char yourself

This

    environment:
      WG_HOST: '${WG_HOST}'
      PASSWORD_HASH: $$2a$$12$$mSNGEiOT7urQP/Xs10XzPurl5cmVj6tavHRZQUK0jIFXRWFBGmssu
      WG_DEFAULT_DNS: 1.1.1.1
      WG_ALLOWED_IPS: '0.0.0.0/0, ::/0'

will be translated to

    environment:
      WG_HOST: '${WG_HOST}'
      PASSWORD_HASH: $$2a$$12$$mSNGEiOT7urQP/Xs10XzPurl5cmVj6tavHRZQUK0jIFXRWFBGmssu
      WG_DEFAULT_DNS: 1.1.1.1
      WG_ALLOWED_IPS: '0.0.0.0/0, ::/0'
      $2a$$12$$mSNGEiOT7urQP/Xs10XzPurl5cmVj6tavHRZQUK0jIFXRWFBGmssu: null
      COOLIFY_CONTAINER_NAME: '"wg-easy-ussck40c4s8kgc0o4coc0ww0"'
      COOLIFY_URL: 'https://example.com'
      COOLIFY_FQDN: exampple.com

There is this extra line:
$2a$$12$$mSNGEiOT7urQP/Xs10XzPurl5cmVj6tavHRZQUK0jIFXRWFBGmssu: null

I tried also without doubling the $ sign and tick the box but same issue

You can remove the created var from environment variable but it seems there is something that recreate if you play with different save/update.

I also tried to set variable that way PASSWORD_HASH: "${WIREGUARD_PASSWORD_HASH}"

However when I'm getting into the container through the terminal the value is never the hash injected through environment variable (truncated or mutated).

Steps to Reproduce

  1. Start a docker-compose.yml project or any project
  2. Try to set an environment variable like this $2a$12$mSNGEiOT7urQP/Xs10XzPurl5cmVj6tavHRZQUK0jIFXRWFBGmssu
  3. Validate it's possible and that the injected value is the proper one from the container

Example Repository URL

No response

Coolify Version

v4.0.0-beta.360

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04.1 LTS

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions