aboutsummaryrefslogtreecommitdiff
path: root/environment.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-21 16:51:56 +0700
committerShulhan <ms@kilabit.info>2024-03-21 16:52:51 +0700
commit842206eacafa273b63beee4ab8a7de3b000dfa73 (patch)
tree29d403e511ee52a9f9b19ca99a2a36ecb3dafe6c /environment.go
parent1b8a3151bbb15322bd22bbff841803c6bc9cd7d0 (diff)
downloadrescached-842206eacafa273b63beee4ab8a7de3b000dfa73.tar.xz
all: replace module "share" with "pakakeh.go"
The module "share" has been moved to new repository at SourceHut and we rename it to make it more unique instead of common English words "share".
Diffstat (limited to 'environment.go')
-rw-r--r--environment.go33
1 files changed, 12 insertions, 21 deletions
diff --git a/environment.go b/environment.go
index 1a0aef5..be46b94 100644
--- a/environment.go
+++ b/environment.go
@@ -10,13 +10,13 @@ import (
"strconv"
"strings"
- "github.com/shuLhan/share/lib/debug"
- "github.com/shuLhan/share/lib/dns"
- libhttp "github.com/shuLhan/share/lib/http"
- "github.com/shuLhan/share/lib/ini"
- "github.com/shuLhan/share/lib/memfs"
- libnet "github.com/shuLhan/share/lib/net"
- libstrings "github.com/shuLhan/share/lib/strings"
+ "git.sr.ht/~shulhan/pakakeh.go/lib/debug"
+ "git.sr.ht/~shulhan/pakakeh.go/lib/dns"
+ libhttp "git.sr.ht/~shulhan/pakakeh.go/lib/http"
+ "git.sr.ht/~shulhan/pakakeh.go/lib/ini"
+ "git.sr.ht/~shulhan/pakakeh.go/lib/memfs"
+ libnet "git.sr.ht/~shulhan/pakakeh.go/lib/net"
+ libstrings "git.sr.ht/~shulhan/pakakeh.go/lib/strings"
)
const (
@@ -79,7 +79,7 @@ type Environment struct {
zoned map[string]*dns.Zone
// The options for WUI HTTP server.
- HttpdOptions *libhttp.ServerOptions `json:"-"`
+ HttpdOptions libhttp.ServerOptions `json:"-"`
dns.ServerOptions
@@ -127,13 +127,6 @@ func newEnvironment(dirBase, fileConfig string) *Environment {
fileConfig: filepath.Join(dirBase, fileConfig),
hostBlockdFile: make(map[string]*dns.HostsFile),
- HttpdOptions: &libhttp.ServerOptions{
- Memfs: mfsWww,
- Address: defWuiAddress,
- },
- ServerOptions: dns.ServerOptions{
- ListenAddress: defListenAddress,
- },
}
}
@@ -151,12 +144,10 @@ func (env *Environment) init() (err error) {
debug.Value = env.Debug
- if env.HttpdOptions == nil {
- env.HttpdOptions = &libhttp.ServerOptions{
- Memfs: mfsWww,
- Address: env.WUIListen,
- }
- } else {
+ if env.HttpdOptions.Memfs == nil {
+ env.HttpdOptions.Memfs = mfsWww
+ }
+ if len(env.HttpdOptions.Address) == 0 {
env.HttpdOptions.Address = env.WUIListen
}