-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
51 lines (43 loc) · 767 Bytes
/
main.go
File metadata and controls
51 lines (43 loc) · 767 Bytes
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
package main
import (
"embed"
"errors"
"io/fs"
"os"
_ "github.com/joho/godotenv/autoload"
"github.com/open-function-computers-llc/secret-share/server"
)
//go:embed frontend/dist
var frontend embed.FS
func main() {
err := checkEnv()
if err != nil {
panic(err)
}
// static assets for Vue app
stripped, err := fs.Sub(frontend, "frontend/dist")
if err != nil {
panic(err)
}
s, err := server.New(stripped)
if err != nil {
panic(err)
}
s.Serve()
}
func checkEnv() error {
requiredEnv := []string{
"BASE_URL",
"MAIL_OUTPUT",
"SMTP_HOST",
"SMTP_PORT",
"SMTP_USERNAME",
"SMTP_PASSWORD",
}
for _, env := range requiredEnv {
if os.Getenv(env) == "" {
return errors.New("required env: " + env + " missing")
}
}
return nil
}