🏡 index : ~doyle/gitlab-cargo-shim.git

author Jordan Doyle <jordan@doyle.la> 2022-03-13 23:10:59.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-03-13 23:10:59.0 +00:00:00
commit
98f77b1596da4c2d22e94ed3ee874734cd712245 [patch]
tree
8140685091e38403f87d8c85f72364443115bf39
parent
f3c78e564570de1f3b69338d3457b72a12065367
download
98f77b1596da4c2d22e94ed3ee874734cd712245.tar.gz

Add configuration option for SSH server socket address



Diff

 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(),