From 0d453ec0b365225be4c317a5301dc60d54dcfa61 Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Thu, 4 Apr 2024 17:33:07 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=BD=93=E3=81=AB=E3=81=BE=E3=81=9F?= =?UTF-8?q?=E7=A7=81=E3=81=AE=E9=82=AA=E9=AD=94=E3=82=92=E3=81=99=E3=82=8B?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F=E3=82=93?= =?UTF-8?q?=E3=81=A7=E3=81=99=E3=81=8B=E3=80=81jmjl=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Izuru Yakumo git-svn-id: https://svn.yakumo.dev/yakumo.izuru/tokiko/trunk@21 8f5ca974-a7f8-e144-9f80-d41d5039c194 --- LICENSE | 2 +- cmd/tokiko/main.go | 19 +++++++++---------- example/tokiko.ini | 3 +-- Gophermap => gophermap | 0 4 files changed, 11 insertions(+), 13 deletions(-) rename Gophermap => gophermap (100%) diff --git a/LICENSE b/LICENSE index f7e2db5..52705fc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ Copyright 2021 Shokara Kou -Copyright 2022, 2023 Izuru Yakumo +Copyright 2022-2024 Izuru Yakumo 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 diff --git a/cmd/tokiko/main.go b/cmd/tokiko/main.go index 4b78508..58edd64 100644 --- a/cmd/tokiko/main.go +++ b/cmd/tokiko/main.go @@ -37,12 +37,12 @@ func parseconfig(file string) error { if err != nil { return err } - conf.port = cfg.Section("").Key("port").String() - conf.addr = cfg.Section("").Key("addr").String() - conf.hostname = cfg.Section("").Key("hostname").String() - conf.rootdir = cfg.Section("").Key("rootdir").String() - conf.user = cfg.Section("").Key("user").String() - conf.group = cfg.Section("").Key("group").String() + conf.port = cfg.Section("tokiko").Key("port").String() + conf.addr = cfg.Section("tokiko").Key("addr").String() + conf.hostname = cfg.Section("tokiko").Key("hostname").String() + conf.rootdir = cfg.Section("tokiko").Key("rootdir").String() + conf.user = cfg.Section("tokiko").Key("user").String() + conf.group = cfg.Section("tokiko").Key("group").String() return nil } @@ -172,15 +172,14 @@ func main() { flag.StringVar(&configfile, "f", "", "Configuration file") flag.Parse() - if configfile != "" { - parseconfig(configfile) - } - conf.addr = "127.0.0.1" conf.port = "70" conf.hostname = "localhost" conf.rootdir = "/var/gopher" + if configfile != "" { + parseconfig(configfile) + } LISTEN_ADDR := conf.addr + ":" + conf.port if conf.user != "" { diff --git a/example/tokiko.ini b/example/tokiko.ini index 537f6f6..d5099b0 100644 --- a/example/tokiko.ini +++ b/example/tokiko.ini @@ -1,3 +1,4 @@ +[tokiko] # IP address to listen on addr = "127.0.0.1" # TCP port to listen on @@ -11,5 +12,3 @@ rootdir = "/var/gopher" # be used. # user = tokiko # group = tokiko - - diff --git a/Gophermap b/gophermap similarity index 100% rename from Gophermap rename to gophermap