source: code/trunk/config/config.go@ 153

Last change on this file since 153 was 152, checked in by Izuru Yakumo, 15 months ago

修理済み

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

File size: 1.1 KB
RevLine 
[127]1package config
2
3import (
[147]4 "gopkg.in/ini.v1"
[127]5)
6
[147]7var Config struct {
[127]8 Debug bool
9 ListenAddress string
10 Key string
11 IPV6 bool
12 RequestTimeout uint
[131]13 FollowRedirect bool
[140]14 MaxConnsPerHost uint
15 UrlParameter string
16 HashParameter string
[149]17 ProxyEnv bool
[127]18}
19
[152]20func ReadConfig(file string) error {
[147]21 cfg, err := ini.Load(file)
22 if err != nil {
23 return err
24 }
25 Config.Debug, _ = cfg.Section("yukari").Key("debug").Bool()
26 Config.ListenAddress = cfg.Section("yukari").Key("listen").String()
27 Config.Key = cfg.Section("yukari").Key("key").String()
28 Config.IPV6, _ = cfg.Section("yukari").Key("ipv6").Bool()
29 Config.RequestTimeout, _ = cfg.Section("yukari").Key("timeout").Uint()
30 Config.FollowRedirect, _ = cfg.Section("yukari").Key("followredirect").Bool()
31 Config.MaxConnsPerHost, _ = cfg.Section("yukari").Key("max_conns_per_host").Uint()
32 Config.UrlParameter = cfg.Section("yukari").Key("urlparam").String()
33 Config.HashParameter = cfg.Section("yukari").Key("hashparam").String()
[149]34 Config.ProxyEnv, _ = cfg.Section("yukari").Key("proxyenv").Bool()
[147]35 return nil
[127]36}
Note: See TracBrowser for help on using the repository browser.