Ejemplo n.º 1
0
// Init step 2: read config file and create logger
func Init2() {
	once2.Do(func() {
		err := loadConfig(filepath.Join(Sitedata, "config.ini"))
		if err != nil {
			fmt.Fprintf(os.Stderr, err.Error())
			os.Exit(1)
		}

		headers := make(map[string]string)
		headers["User-Agent"] = fmt.Sprintf("QReader %s (%s)", Version.Version, Github)

		NormalFetcher = h.NewFetcher(nil, headers)

		if UseProxy != PROXY_NEVER {
			socks5client, err := h.Socks5Client(*ProxyConfig)
			if err != nil {
				fmt.Fprintf(os.Stderr, err.Error())
				os.Exit(1)
			}

			Socks5Fetcher = h.NewFetcher(socks5client, headers)
		}

		if Debug {
			Orm.ShowSQL = true
		}

		// create logger
		Logger, err = createLogger(logfile, loglevel, Permission)
		if err != nil {
			fmt.Fprintf(os.Stderr, err.Error())
			os.Exit(1)
		}
	})
}
Ejemplo n.º 2
0
func init() {
	header := make(map[string]string)
	header["User-Agent"] = "feedreader (http://github.com/m3ng9i/feedreader)"

	defaultFetcher = httphelper.NewFetcher(nil, header)
}