source: Main/trunk/config/config.go@ 4a5f10f

Last change on this file since 4a5f10f was 4a5f10f, checked in by www <www@…>, 8 weeks ago

Mirrored from https://git.chaotic.ninja/git/yakumo_izuru/yukari

git-svn-id: https://svn.chaotic.ninja/svn/yukari-yakumo.izuru@1 ee30ecee-8fc8-4245-a645-e3b2cc3919a6

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[4a5f10f]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 ProxyEnv bool
18}
19
20func ReadConfig(file string) error {
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()
34 Config.ProxyEnv, _ = cfg.Section("yukari").Key("proxyenv").Bool()
35 return nil
36}
Note: See TracBrowser for help on using the repository browser.