-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathmain.go
61 lines (52 loc) · 1.43 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// A web interface to your media library.
//
// This file is only here to make installing with go get easier.
// At the moment I don't see any other way to stash my source in the src directory
// instead of dumping it in the project root.
package main
import (
"embed"
"fmt"
"io/fs"
"os"
"github.com/ironsmile/euterpe/src"
)
var (
// sqlFilesFS the migrations directory which contains SQL
// migrations for sql-migrate and the initial schema. If the
// embedded directory name changes, remember to change it in
// main() too.
//
//go:embed sqls
sqlFilesFS embed.FS
// httpRootFS is the directory which contains the
// static files served by HTTPMS. If the embedded directory
// name changes remember to change it in main() too.
//
//go:embed http_root
httpRootFS embed.FS
// htmlTemplatesFS is the directory with HTML templates. If
// the embedded directory name changes, remember to change it
// in main() too.
//
//go:embed templates
htmlTemplatesFS embed.FS
)
func main() {
fsRoot, err := fs.Sub(httpRootFS, "http_root")
if err != nil {
fmt.Fprintf(os.Stderr, "loading HTTP root subFS: %s\n", err)
os.Exit(1)
}
tpls, err := fs.Sub(htmlTemplatesFS, "templates")
if err != nil {
fmt.Fprintf(os.Stderr, "loading templates subFS: %s\n", err)
os.Exit(1)
}
sqls, err := fs.Sub(sqlFilesFS, "sqls")
if err != nil {
fmt.Fprintf(os.Stderr, "loading sqls subFS: %s\n", err)
os.Exit(1)
}
src.Main(fsRoot, tpls, sqls)
}