diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-13 15:16:11 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-13 15:16:11 +0800 |
commit | 1364d688e454454258c6c97b1dc844cc94a67a9e (patch) | |
tree | f95b9370cff76eeba71b86dbcd7333586ba1f7a9 /ssh_url_generation.go | |
parent | {http,ssh}_server.go: Add debug logs for incoming requests (diff) | |
download | forge-1364d688e454454258c6c97b1dc844cc94a67a9e.tar.gz forge-1364d688e454454258c6c97b1dc844cc94a67a9e.tar.zst forge-1364d688e454454258c6c97b1dc844cc94a67a9e.zip |
ssh_url_generation.go, etc.: Add config ssh.root and use it
Detecting it based on HTTP host name is definitely unreliable.
Just add a configuration option and it should work.
Diffstat (limited to 'ssh_url_generation.go')
-rw-r--r-- | ssh_url_generation.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ssh_url_generation.go b/ssh_url_generation.go new file mode 100644 index 0000000..0cf4c1e --- /dev/null +++ b/ssh_url_generation.go @@ -0,0 +1,11 @@ +package main + +import ( + "net/url" + "strings" +) + +func generate_ssh_remote_url(group_name, repo_name string) string { + return strings.TrimSuffix(config.SSH.Root, "/")+"/"+url.PathEscape(group_name)+"/:/repos/"+url.PathEscape(repo_name) +} + |