-
Notifications
You must be signed in to change notification settings - Fork 24
/
fms.go
54 lines (45 loc) · 1.11 KB
/
fms.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Simple Admin File
//
// This is simple admin file manager api doc
//
// Schemes: http, https
// Host: localhost:9102
// BasePath: /
// Version: 1.6.0
// Contact: [email protected]
// securityDefinitions:
// Token:
// type: apiKey
// name: Authorization
// in: header
// security:
// - Token: []
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// swagger:meta
package main
import (
"flag"
"fmt"
"github.com/suyuan32/simple-admin-file/internal/config"
"github.com/suyuan32/simple-admin-file/internal/handler"
"github.com/suyuan32/simple-admin-file/internal/svc"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest"
)
var configFile = flag.String("f", "etc/fms.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
server := rest.MustNewServer(c.RestConf, rest.WithCors(c.CROSConf.Address))
defer server.Stop()
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}