From c33ea8e8a836394f56654f6be97cf6de8306dba8 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 18 Jan 2025 17:07:21 +0200 Subject: [PATCH] Make GITEA__server__SSH_PORT configurable and default it to a sane value Ref: https://github.com/mother-of-all-self-hosting/ansible-role-forgejo/commit/12c860788b963537e0a0f4fe19f2e1548367a6d1 --- defaults/main.yml | 6 ++++++ templates/env.j2 | 3 ++- templates/gitea.service.j2 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index cdd1a4d..fe9a8ac 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -58,6 +58,12 @@ gitea_config_mailer_passwd: '' gitea_config_root_url: "{{ gitea_scheme }}://{{ gitea_hostname }}{{ gitea_path_prefix }}" +# Controls the `GITEA__server__SSH_PORT` environment variable. +gitea_config_server_ssh_port: "{{ gitea_ssh_port }}" + +# Controls the `GITEA__server__SSH_LISTEN_PORT` environment variable. +gitea_config_server_ssh_listen_port: 2222 + # Controls the RUN_USER configuration setting (`GITEA____RUN_USER` environment variable). # # This defaults to `git` in the upstream configuration. diff --git a/templates/env.j2 b/templates/env.j2 index f5e2018..b2b488f 100644 --- a/templates/env.j2 +++ b/templates/env.j2 @@ -1,6 +1,7 @@ GITEA__server__ROOT_URL={{ gitea_config_root_url }} -GITEA__server__SSH_LISTEN_PORT=2222 +GITEA__server__SSH_PORT={{ gitea_config_server_ssh_port }} +GITEA__server__SSH_LISTEN_PORT={{ gitea_config_server_ssh_listen_port }} GITEA__database__DB_TYPE={{ gitea_config_database_type }} GITEA__database__HOST={{ gitea_config_database_hostname }}:{{ gitea_config_database_port }} diff --git a/templates/gitea.service.j2 b/templates/gitea.service.j2 index 5cf635a..b70c019 100644 --- a/templates/gitea.service.j2 +++ b/templates/gitea.service.j2 @@ -25,7 +25,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ -p {{ gitea_http_bind_port }}:3000 \ {% endif %} {% if gitea_ssh_bind_port != '' %} - -p {{ gitea_ssh_bind_port }}:2222 \ + -p {{ gitea_ssh_bind_port }}:{{ gitea_config_server_ssh_listen_port }} \ {% endif %} --env-file={{ gitea_base_path }}/env \ --label-file={{ gitea_base_path }}/labels \