forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (40 loc) · 1.12 KB
/
main.go
File metadata and controls
46 lines (40 loc) · 1.12 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
package main
import (
"fmt"
"os"
"strings"
"github.com/NdoleStudio/httpsms/docs"
"github.com/NdoleStudio/httpsms/pkg/di"
)
// Version is injected at runtime
var Version string
// @title httpSMS API Reference
// @version 1.0
// @description Use your Android phone to send and receive SMS messages via a simple programmable API with end-to-end encryption.
//
// @contact.name support@httpsms.com
// @contact.email support@httpsms.com
//
// @license.name AGPL-3.0
// @license.url https://raw.githubusercontent.com/NdoleStudio/http-sms-manager/main/LICENSE
//
// @host api.httpsms.com
// @schemes https
// @BasePath /v1
//
// @securitydefinitions.apikey ApiKeyAuth
// @in header
// @name x-api-Key
func main() {
if len(os.Args) == 1 {
di.LoadEnv()
}
if host := strings.TrimSpace(os.Getenv("SWAGGER_HOST")); len(host) > 0 {
docs.SwaggerInfo.Host = host
}
if len(Version) > 0 {
docs.SwaggerInfo.Version = Version
}
container := di.NewContainer(os.Getenv("GCP_PROJECT_ID"), Version)
container.Logger().Info(container.App().Listen(fmt.Sprintf("%s:%s", os.Getenv("APP_HOST"), os.Getenv("APP_PORT"))).Error())
}