-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (33 loc) · 961 Bytes
/
main.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
package main
import (
_ "embed"
"fmt"
_ "go.dsig.cn/shortener/internal/bootstrap"
"github.com/spf13/viper"
"go.dsig.cn/shortener/internal/routers"
)
//go:embed version.txt
var version string
var description = `
_____ _ _
/ ____| | | |
| (___ | |__ ___ _ __| |_ ___ _ __ ___ _ __
\___ \| '_ \ / _ \| '__| __/ _ \ '_ \ / _ \ '__|
____) | | | | (_) | | | || __/ | | | __/ |
|_____/|_| |_|\___/|_| \__\___|_| |_|\___|_|
Shortener: %s
Project: https://git.jetsung.com/idev/shortener
Website: https://i.jetsung.com
Author: Jetsung Chan <i@jetsung.com>
`
func main() {
addr := viper.GetString("server.address")
if addr == "" {
addr = ":8080"
}
fmt.Printf(description, version)
r := routers.NewRouter()
if err := r.Run(addr); err != nil {
panic("run server failed: " + err.Error())
}
}