Skip to content

Clone instructions do not respect SSH_DOMAIN variable when set as an environment variable #19453

Closed
@darth-veitcher

Description

@darth-veitcher

Description

I'm running with the docker image and have the following set as environment variables. The idea being to have a separate domain for ssh cloning of repositories as the primary domain goes via Cloudflare proxy (and therefore blocks the SSH protocol).

# file: docker-compose.yaml
gitea:
    image: gitea/gitea
    container_name: gitea
    hostname: git.mydomain.tld
    restart: always
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=postgres
      - DB_HOST=db:5432
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
      # Customise
      - GITEA____APP_NAME="My Gitea Instance"
      - GITEA__server__DOMAIN="git.mydomain.tld"
      - GITEA__server__ROOT_URL="https://git.mydomain.tld"
      - GITEA__server__SSH_DOMAIN="clone.mydomain.tld"
    networks:
      - gitea
    volumes:
      - ./data/gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - db
      - redis
      - minio

On creating a new repository however I'm getting presenting with a SSH clone url which reflects the DOMAIN as opposed to the SSH_DOMAIN.

On investigation it seems as though this environment variable has not been respected and passed through to the underlying app.ini. If login into the container and inspect the file it shows the following:

# file: /data/gitea/conf/app.ini
...
[server]
APP_DATA_PATH    = /data/gitea
DOMAIN           = git.mydomain.tld
SSH_DOMAIN       = git.mydomain.tld
...

If I manually edit this file inside the container to adjust the SSH_DOMAIN variable and restart it then the setting is respected.

Gitea Version

1.16.5 built with GNU Make 4.3, go1.18 : bindata, timetzdata, sqlite, sqlite_unlock_notify

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Gitea is running with docker and docker-compose using image: gitea/gitea

Database

PostgreSQL

Activity

mike1936

mike1936 commented on Sep 29, 2022

@mike1936

Voting up this issue.
Neither [server] DOMAIN nor [server] SSH_DOMAIN.
Version 1.17.1

zeripath

zeripath commented on Feb 8, 2023

@zeripath
Contributor

The only way this could not be working is if you're running the install page.

Why are you running the install page on every container restart?

added a commit that references this issue on Jul 9, 2023
fa0b5b1
added a commit that references this issue on Jul 10, 2023
7967333
added a commit that references this issue on Jul 10, 2023
b4460cf
locked as resolved and limited conversation to collaborators on Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @darth-veitcher@zeripath@mike1936

      Issue actions

        Clone instructions do not respect `SSH_DOMAIN` variable when set as an environment variable · Issue #19453 · go-gitea/gitea