File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1
1
package controllers
2
2
3
3
import (
4
+ "bytes"
5
+ "encoding/json"
4
6
"errors"
5
7
"fmt"
6
8
"strconv"
@@ -303,3 +305,24 @@ func FetchMetrics(c *gin.Context) {
303
305
"data" : metricsRecord ,
304
306
})
305
307
}
308
+
309
+ func FetchAppRemote (c * gin.Context ) {
310
+ appName := c .Param ("app" )
311
+ config , err := mongo .FetchSingleApp (appName )
312
+ if err != nil {
313
+ c .AbortWithStatusJSON (400 , gin.H {
314
+ "success" : false ,
315
+ "error" : err .Error (),
316
+ })
317
+ }
318
+
319
+ response := & types.ApplicationRemote {
320
+ GitURL : config .Git .RepoURL ,
321
+ }
322
+
323
+ fmt .Println (response )
324
+
325
+ responseBody := new (bytes.Buffer )
326
+ json .NewEncoder (responseBody ).Encode (response )
327
+ c .Data (200 , "application/json" , responseBody .Bytes ())
328
+ }
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ func NewService() http.Handler {
72
72
app .PATCH ("/:app/transfer/:user" , m .IsAppOwner , c .TransferApplicationOwnership )
73
73
app .GET ("/:app/term" , m .IsAppOwner , c .DeployWebTerminal )
74
74
app .GET ("/:app/metrics" , m .IsAppOwner , c .FetchMetrics )
75
+ app .GET ("/:app/remote" , m .IsAppOwner , c .FetchAppRemote )
75
76
}
76
77
77
78
db := router .Group ("/dbs" )
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ type ApplicationConfig struct {
93
93
Success bool `json:"success,omitempty" bson:"-"`
94
94
}
95
95
96
+ type ApplicationRemote struct {
97
+ GitURL string `json:"giturl" bson:"giturl"`
98
+ }
99
+
96
100
// GetName returns the application's name
97
101
func (app * ApplicationConfig ) GetName () string {
98
102
return app .Name
You can’t perform that action at this time.
0 commit comments