aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-12-19 14:40:18 +0700
committerShulhan <ms@kilabit.info>2021-12-19 14:40:18 +0700
commit7ee3e4ea4658e85a40540212b95206b09686feb7 (patch)
treebabe6a3568f6ead05799e0af31c6d5f6851cfa0b /cmd
parent7713203c6bd41053599732869a70467a168e4e55 (diff)
downloadrescached-7ee3e4ea4658e85a40540212b95206b09686feb7.tar.xz
all: refactoring Server initialization
Previously, we initialize the rescached Server by passing the path to configuration file and initialize the environment inside the server. This commit changes it to pass the instance of Environment. The idea is to allow creating and running rescached Server without creating configuration file first.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/rescached/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/rescached/main.go b/cmd/rescached/main.go
index a43eefd..ebf0a62 100644
--- a/cmd/rescached/main.go
+++ b/cmd/rescached/main.go
@@ -29,7 +29,12 @@ func main() {
flag.StringVar(&fileConfig, "config", "", "path to configuration")
flag.Parse()
- rcd, err := rescached.New(fileConfig)
+ env, err := rescached.LoadEnvironment(fileConfig)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ rcd, err := rescached.New(env)
if err != nil {
log.Fatal(err)
}