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

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

コードのリファクタリングが完了しました

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

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