This commit is contained in:
2023-01-10 19:10:20 +01:00
parent e590714391
commit 9aef8fc47b
34 changed files with 780 additions and 3 deletions

39
main.go Normal file
View File

@@ -0,0 +1,39 @@
package main
import (
"context"
"embed"
"io/fs"
"log"
"os"
"github.com/marcopeocchi/yt-dlp-web-ui/server"
)
type ContextKey interface{}
var (
port = os.Getenv("PORT")
//go:embed dist/frontend
frontend embed.FS
)
func init() {
if port == "" {
port = "3033"
}
}
func main() {
frontend, err := fs.Sub(frontend, "dist/frontend")
if err != nil {
log.Fatalln(err)
}
ctx := context.Background()
ctx = context.WithValue(ctx, ContextKey("port"), port)
ctx = context.WithValue(ctx, ContextKey("frontend"), frontend)
server.RunBlocking(ctx)
}