-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
48 lines (39 loc) · 1.08 KB
/
main.go
File metadata and controls
48 lines (39 loc) · 1.08 KB
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
package main
import (
"Intern_Backend/config"
"Intern_Backend/docs"
"Intern_Backend/routes"
"Intern_Backend/utils"
"log"
"github.com/joho/godotenv"
)
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @termsOfService http://swagger.io/terms/
func main() {
// for load godotenv
// for env
environment := utils.Getenv("ENVIRONMENT", "development")
if environment == "development" {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
}
//programmatically set swagger info
docs.SwaggerInfo.Title = "Test API"
docs.SwaggerInfo.Description = "Testing API Produk."
docs.SwaggerInfo.Version = "1.0"
//could be changed, based on the services domain
docs.SwaggerInfo.Host = "industrial-backend.azurewebsites.net"
docs.SwaggerInfo.Schemes = []string{"http", "https"}
//db config
db := config.ConnectDataBase()
sqlDB, _ := db.DB()
defer sqlDB.Close()
r := routes.SetupRouter(db)
r.Run(":80")
}