Commit 515019d69510d722dd1edec0c40ae4508f536e5e

Thomas de Grivel 2021-12-13T15:04:01

show urls

diff --git a/config/config.exs b/config/config.exs
index 799c8c7..f674808 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -8,10 +8,10 @@
 import Config
 
 config :kmxgit,
-  recaptcha_site_key: System.get_env("RECAPTCHA_SITE_KEY"),
+  ecto_repos: [Kmxgit.Repo],
+  git_ssh_url: "git@git.kmx.io",
   recaptcha_secret: System.get_env("RECAPTCHA_SECRET"),
-  ssh_url: "git@git.kmx.io",
-  ecto_repos: [Kmxgit.Repo]
+  recaptcha_site_key: System.get_env("RECAPTCHA_SITE_KEY")
 
 # Configures the endpoint
 config :kmxgit, KmxgitWeb.Endpoint,
diff --git a/lib/kmxgit/repository_manager/repository.ex b/lib/kmxgit/repository_manager/repository.ex
index 9156abc..24de02a 100644
--- a/lib/kmxgit/repository_manager/repository.ex
+++ b/lib/kmxgit/repository_manager/repository.ex
@@ -115,9 +115,13 @@ defmodule Kmxgit.RepositoryManager.Repository do
   end
 
   def ssh_url(repo) do
-    ssh_root = Application.get_env(:kmxgit, :ssh_url)
+    ssh_root = Application.get_env(:kmxgit, :git_ssh_url)
     "#{ssh_root}:#{full_slug(repo)}.git"
   end
+  def http_url(repo) do
+    http_root = KmxgitWeb.Endpoint.url()
+    "#{http_root}/#{full_slug(repo)}.git"
+  end
 
   def splat(repo, rest \\ []) do
     String.split(repo.slug, "/") ++ rest
diff --git a/lib/kmxgit_web/templates/admin/repository/show.html.heex b/lib/kmxgit_web/templates/admin/repository/show.html.heex
index d1d0864..d1f7622 100644
--- a/lib/kmxgit_web/templates/admin/repository/show.html.heex
+++ b/lib/kmxgit_web/templates/admin/repository/show.html.heex
@@ -24,6 +24,14 @@
       <td><%= link Repository.full_slug(@repo), to: Routes.repository_path(@conn, :show, Repository.owner_slug(@repo), Repository.splat(@repo)) %></td>
     </tr>
     <tr>
+      <th><%= gettext "Git HTTP" %></th>
+      <td><%= Repository.http_url(@repo) %></td>
+    </tr>
+    <tr>
+      <th><%= gettext "Git SSH" %></th>
+      <td><%= Repository.ssh_url(@repo) %></td>
+    </tr>
+    <tr>
       <th><%= gettext "Public access ?" %></th>
       <td>
         <%= if @repo.public_access do %>
diff --git a/lib/kmxgit_web/templates/repository/show.html.heex b/lib/kmxgit_web/templates/repository/show.html.heex
index 40fcb11..78d61bb 100644
--- a/lib/kmxgit_web/templates/repository/show.html.heex
+++ b/lib/kmxgit_web/templates/repository/show.html.heex
@@ -54,7 +54,11 @@
       <h2><%= gettext "Properties" %></h2>
       <table class="table admin-properties">
         <tr>
-          <th><%= gettext "SSH" %></th>
+          <th><%= gettext "Git HTTP" %></th>
+          <td><%= Repository.http_url(@repo) %></td>
+        </tr>
+        <tr>
+          <th><%= gettext "Git SSH" %></th>
           <td><%= Repository.ssh_url(@repo) %></td>
         </tr>
         <tr>