This repository was archived by the owner on May 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,32 @@ package main
2
2
3
3
import (
4
4
"fmt"
5
+ "os"
6
+ "time"
5
7
6
8
"github.com/sirupsen/logrus"
9
+ "github.com/typical-go/typical-go/pkg/envkit"
7
10
"github.com/typical-go/typical-go/pkg/typapp"
8
11
"github.com/typical-go/typical-go/pkg/typgo"
9
12
"github.com/typical-go/typical-rest-server/internal/app"
10
13
14
+ // Important to enable dependency injectino
11
15
_ "github.com/typical-go/typical-rest-server/internal/generated/ctor"
12
16
_ "github.com/typical-go/typical-rest-server/internal/generated/envcfg"
13
17
)
14
18
15
19
func main () {
16
- fmt .Printf ("%s %s\n " , typgo .ProjectName , typgo .ProjectVersion )
20
+ // Print application header
21
+ fmt .Printf ("Start %s (%s) at %s\n " ,
22
+ typgo .ProjectName , typgo .ProjectVersion , time .Now ().Format (time .RFC3339 ))
23
+
24
+ // Read dotenv file
25
+ if dotenv := os .Getenv ("CONFIG" ); dotenv != "" {
26
+ fmt .Printf ("Set ENV from '%s'" , dotenv )
27
+ m , _ := envkit .ReadFile (dotenv )
28
+ envkit .Setenv (m )
29
+ }
30
+
17
31
if err := typapp .StartApp (app .Start , app .Shutdown ); err != nil {
18
32
logrus .Fatal (err .Error ())
19
33
}
You can’t perform that action at this time.
0 commit comments