Commit ddd90fd 1 parent efc7efd commit ddd90fd Copy full SHA for ddd90fd
File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
package config
2
2
3
3
import (
4
+ "github.com/spf13/cast"
5
+ "os"
4
6
"strings"
5
7
"time"
6
8
@@ -26,6 +28,14 @@ func New() *Config {
26
28
return v
27
29
}
28
30
31
+ func GetPort () int {
32
+ port := cast .ToInt (os .Getenv ("PORT" ))
33
+ if port == 0 {
34
+ port = 3000
35
+ }
36
+ return port
37
+ }
38
+
29
39
func init () {
30
40
cfg := New ()
31
41
cfg .AutomaticEnv ()
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ package main
2
2
3
3
import (
4
4
"fmt"
5
- "github.com/diggerhq/digger/backend/segment"
6
5
"github.com/diggerhq/digger/backend/config"
6
+ "github.com/diggerhq/digger/backend/segment"
7
7
"html/template"
8
8
"io/fs"
9
9
"log"
@@ -186,7 +186,9 @@ func main() {
186
186
runsApiGroup .POST ("/:run_id/approve" , controllers .ApproveRun )
187
187
188
188
fronteggWebhookProcessor .POST ("/create-org-from-frontegg" , controllers .CreateFronteggOrgFromWebhook )
189
- r .Run (fmt .Sprintf (":%d" , cfg .GetInt ("port" )))
189
+
190
+ port := config .GetPort ()
191
+ r .Run (fmt .Sprintf (":%d" , port ))
190
192
}
191
193
192
194
func initLogging () {
You can’t perform that action at this time.
0 commit comments