Last active
February 9, 2023 21:31
-
-
Save brurucy/fffd9d47c1ff04ab1bea59c828cc1073 to your computer and use it in GitHub Desktop.
memoir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
log := logger.New(verbose) | |
if err != nil { … } | |
rawSchemata, err := os.ReadFile(SCHEMATA_LOCATION) | |
if err != nil { … } | |
schemata := schema.Schemata{} | |
if err = yaml.Unmarshal(rawSchemata, &schemata); err != nil { … } | |
app := gin.New() | |
server.AddRoutes(app, git.New(), memfs.New(), schemata, log) | |
srv := &http.Server{ | |
Addr: ":3000", | |
Handler: app, | |
} | |
go func() {if err = srv.ListenAndServe(); err != nil && errors.Is(err, http.ErrServerClosed) {..}}() | |
ctx, cancel := context.WithTimeout(context.Background(), GRACEFUL_SHUTDOWN_TIMEOUT) | |
defer cancel() | |
serv := server.New(srv) | |
quitter := make(chan os.Signal) | |
server.StartGracefulShutdownWatcher(ctx, serv, log, quitter) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment