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"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
)
|
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-23 01:07:34 +03:00
|
|
|
defer storage.Current.Terminate()
|
2020-08-23 01:06:29 +03:00
|
|
|
|
|
|
|
// Wait for the program to exit
|
|
|
|
// TODO: Replace this through blocking API server
|
|
|
|
sc := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
|
|
|
<-sc
|
2020-08-22 23:13:43 +03:00
|
|
|
}
|