2020-08-22 23:13:43 +03:00
|
|
|
package main
|
|
|
|
|
2020-08-23 01:06:29 +03:00
|
|
|
import (
|
|
|
|
"github.com/Lukaesebrot/pasty/internal/env"
|
|
|
|
"github.com/Lukaesebrot/pasty/internal/storage"
|
2020-08-23 01:32:46 +03:00
|
|
|
"github.com/Lukaesebrot/pasty/internal/web"
|
2020-08-23 01:06:29 +03:00
|
|
|
"log"
|
|
|
|
)
|
2020-08-23 00:24:38 +03:00
|
|
|
|
2020-08-22 23:13:43 +03:00
|
|
|
func main() {
|
2020-08-23 00:24:38 +03:00
|
|
|
// Load the optional .env file
|
2020-08-23 01:06:29 +03:00
|
|
|
log.Println("Loading the optional .env file...")
|
2020-08-23 00:24:38 +03:00
|
|
|
env.Load()
|
2020-08-23 01:06:29 +03:00
|
|
|
|
|
|
|
// Load the configured storage driver
|
|
|
|
log.Println("Loading the configured storage driver...")
|
|
|
|
err := storage.Load()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2020-08-24 19:08:27 +03:00
|
|
|
defer func() {
|
|
|
|
log.Println("Terminating the storage driver...")
|
|
|
|
err := storage.Current.Terminate()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalln(err)
|
|
|
|
}
|
|
|
|
}()
|
2020-08-23 01:06:29 +03:00
|
|
|
|
2020-08-23 17:44:06 +03:00
|
|
|
// Serve the web resources
|
|
|
|
log.Println("Serving the web resources...")
|
2020-08-23 01:32:46 +03:00
|
|
|
panic(web.Serve())
|
2020-08-22 23:13:43 +03:00
|
|
|
}
|