aboutsummaryrefslogtreecommitdiff
path: root/rescached.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-12-21 08:56:21 +0700
committerShulhan <ms@kilabit.info>2021-12-21 08:56:21 +0700
commit51af8aca85c8b2a264d99d3929b4259aa4717e7a (patch)
treeab7bf63472b8f92d8709190600a71f7882245a44 /rescached.go
parenta29a8c8396fc16af744a0abc86b5aca343aa620a (diff)
downloadrescached-51af8aca85c8b2a264d99d3929b4259aa4717e7a.tar.xz
all: move HTTP server option to Environment
Previously, the options for HTTP server initialized internally, which make it uneasy to changes the default rescached instance when running in development mode. This commit move the HTTP server initialization inside the Environment init method. If its nil, the init will set the default HTTP server options along with the Memfs.
Diffstat (limited to 'rescached.go')
-rw-r--r--rescached.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/rescached.go b/rescached.go
index a283826..78d25fd 100644
--- a/rescached.go
+++ b/rescached.go
@@ -42,6 +42,13 @@ func New(env *Environment) (srv *Server, err error) {
fmt.Printf("--- rescached: config: %+v\n", env)
}
+ err = env.init()
+ if err != nil {
+ return nil, fmt.Errorf("rescached: New: %w", err)
+ }
+
+ env.initHostsBlock()
+
srv = &Server{
env: env,
}