From 98f77b1596da4c2d22e94ed3ee874734cd712245 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 13 Mar 2022 23:10:59 +0000 Subject: [PATCH] Add configuration option for SSH server socket address --- config.toml | 3 +++ src/config.rs | 3 ++- src/main.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config.toml b/config.toml index 147f487..0830a09 100644 --- a/config.toml +++ a/config.toml @@ -1,3 +1,6 @@ +# socket address for the SSH server to listen on +listen-address = "[::]:2222" + # directory in which the generated private keys for the server # should be stored state-directory = "/var/lib/gitlab-cargo-shim" diff --git a/src/config.rs b/src/config.rs index fca06c6..915fa0a 100644 --- a/src/config.rs +++ a/src/config.rs @@ -1,8 +1,8 @@ #![allow(clippy::module_name_repetitions)] use clap::Parser; use serde::{de::DeserializeOwned, Deserialize}; -use std::path::PathBuf; +use std::{path::PathBuf, net::SocketAddr}; use url::Url; #[derive(Parser)] @@ -15,6 +15,7 @@ #[derive(Deserialize)] #[serde(rename_all = "kebab-case")] pub struct Config { + pub listen_address: SocketAddr, pub state_directory: PathBuf, pub gitlab: GitlabConfig, } diff --git a/src/main.rs b/src/main.rs index e2689d2..796d813 100644 --- a/src/main.rs +++ a/src/main.rs @@ -97,7 +97,7 @@ thrussh::server::run( thrussh_config, - "127.0.0.1:2210", + &args.config.listen_address.to_string(), Server { gitlab, metadata_cache: MetadataCache::default(), -- rgit 0.1.3