本当にまた私の邪魔をする必要があったんですか、jmjl?

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/tokiko/trunk@21 8f5ca974-a7f8-e144-9f80-d41d5039c194
This commit is contained in:
yakumo.izuru 2024-04-04 17:33:07 +00:00
parent 9278b29d0f
commit 448c205bbf
4 changed files with 11 additions and 13 deletions

View File

@ -1,5 +1,5 @@
Copyright 2021 Shokara Kou Copyright 2021 Shokara Kou
Copyright 2022, 2023 Izuru Yakumo <yakumo.izuru@chaotic.ninja> Copyright 2022-2024 Izuru Yakumo <yakumo.izuru@chaotic.ninja>
Permission to use, copy, modify, and distribute this software for any purpose Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice with or without fee is hereby granted, provided that the above copyright notice

View File

@ -37,12 +37,12 @@ func parseconfig(file string) error {
if err != nil { if err != nil {
return err return err
} }
conf.port = cfg.Section("").Key("port").String() conf.port = cfg.Section("tokiko").Key("port").String()
conf.addr = cfg.Section("").Key("addr").String() conf.addr = cfg.Section("tokiko").Key("addr").String()
conf.hostname = cfg.Section("").Key("hostname").String() conf.hostname = cfg.Section("tokiko").Key("hostname").String()
conf.rootdir = cfg.Section("").Key("rootdir").String() conf.rootdir = cfg.Section("tokiko").Key("rootdir").String()
conf.user = cfg.Section("").Key("user").String() conf.user = cfg.Section("tokiko").Key("user").String()
conf.group = cfg.Section("").Key("group").String() conf.group = cfg.Section("tokiko").Key("group").String()
return nil return nil
} }
@ -172,15 +172,14 @@ func main() {
flag.StringVar(&configfile, "f", "", "Configuration file") flag.StringVar(&configfile, "f", "", "Configuration file")
flag.Parse() flag.Parse()
if configfile != "" {
parseconfig(configfile)
}
conf.addr = "127.0.0.1" conf.addr = "127.0.0.1"
conf.port = "70" conf.port = "70"
conf.hostname = "localhost" conf.hostname = "localhost"
conf.rootdir = "/var/gopher" conf.rootdir = "/var/gopher"
if configfile != "" {
parseconfig(configfile)
}
LISTEN_ADDR := conf.addr + ":" + conf.port LISTEN_ADDR := conf.addr + ":" + conf.port
if conf.user != "" { if conf.user != "" {

View File

@ -1,3 +1,4 @@
[tokiko]
# IP address to listen on # IP address to listen on
addr = "127.0.0.1" addr = "127.0.0.1"
# TCP port to listen on # TCP port to listen on
@ -11,5 +12,3 @@ rootdir = "/var/gopher"
# be used. # be used.
# user = tokiko # user = tokiko
# group = tokiko # group = tokiko