Add bolt store
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
"gitea.benny.dog/torjus/ezshare/config"
|
||||
"gitea.benny.dog/torjus/ezshare/pb"
|
||||
"gitea.benny.dog/torjus/ezshare/server"
|
||||
"gitea.benny.dog/torjus/ezshare/store"
|
||||
"github.com/urfave/cli/v2"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
@@ -137,7 +136,12 @@ func ActionServe(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
fileStore := store.NewMemoryFileStore()
|
||||
// Setup store
|
||||
s, closeFunc, err := cfg.Server.StoreConfig.GetStore()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to initialize store: %w", err)
|
||||
}
|
||||
defer closeFunc()
|
||||
// Setup shutdown-handling
|
||||
rootCtx, rootCancel := signal.NotifyContext(context.Background(), os.Interrupt)
|
||||
defer rootCancel()
|
||||
@@ -157,7 +161,7 @@ func ActionServe(c *cli.Context) error {
|
||||
grpcAddr = c.String("grpc-addr")
|
||||
}
|
||||
|
||||
grpcFileServer := server.NewGRPCFileServiceServer(fileStore)
|
||||
grpcFileServer := server.NewGRPCFileServiceServer(s)
|
||||
if c.IsSet("hostname") {
|
||||
grpcFileServer.Hostname = c.String("hostname")
|
||||
}
|
||||
@@ -215,7 +219,7 @@ func ActionServe(c *cli.Context) error {
|
||||
if c.IsSet("http-addr") {
|
||||
httpAddr = c.String("http-addr")
|
||||
}
|
||||
httpServer := server.NewHTTPSever(fileStore)
|
||||
httpServer := server.NewHTTPSever(s)
|
||||
httpServer.Addr = httpAddr
|
||||
|
||||
// wait for cancel
|
||||
|
Reference in New Issue
Block a user