示例#1
0
文件: app.go 项目: speedland/service
func init() {
	wcg.ConfigureProcess("wcg.ini") // we don't rely on wcg.ini file and configure using default properties.
	s := server.NewInstance()
	// s.Init = serverInit
	// s.Include(	)
	s.Run()
}
示例#2
0
文件: app.go 项目: speedland/service
func init() {
	wcg.ConfigureProcess("wcg.ini") // we don't rely on wcg.ini file and configure using default properties.
	s := server.NewInstance()
	s.Init = serverInit
	s.Include(
		admin.NewApp(),
		hooks.NewApp(),
		debug.NewApp(s),
		users.NewApp(),
		home.NewApp(),
		pt.NewApp(),
		hplinkapi.NewApp(),
		hplinkadmin.NewApp(),
		hplinkoperations.NewApp(),
	)
	s.Run()
}
示例#3
0
func InitLog(configPath string) {
	logsink.UseFileConfig()
	wcg.ConfigureProcess(configPath)
	var logger = wcg.NewLogger(nil)
	if wcg.DefaultLogConfig.NumSinks() == 0 {
		wcg.DefaultLogConfig.AddSink(
			logsink.NewIOLogSink(
				"",
				os.Stderr,
				true,
			),
			wcg.DefaultLogConfig.Level,
		)
		logger.Warnf("No LogSink is specified, fail back to stderr")
	}
	// normalize path
	logger.Infof("Used configuration file: %q", configPath)
	logger.Infof("Target Endpoint: %q", DefaultConfig.Endpoint)
	logger.Debugf("Token: %q", DefaultConfig.Token)
}
示例#4
0
文件: main.go 项目: speedland/service
func main() {
	app := cli.NewApp()
	app.Name = "speedland-ng-gphoto"
	app.Usage = "Google Photo Client for speedland-ng app"
	app.Version = version
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:   "config, c",
			Value:  "wcg.ini",
			Usage:  "configuration file",
			EnvVar: "WCG_INI_FILE",
		},
	}
	app.Before = func(c *cli.Context) error {
		logsink.UseFileConfig()
		wcg.ConfigureProcess(c.String("config"))
		if wcg.DefaultLogConfig.NumSinks() == 0 {
			wcg.DefaultLogConfig.AddSink(
				logsink.NewIOLogSink(
					"",
					os.Stderr,
					true,
				),
				wcg.DefaultLogConfig.Level,
			)
		}
		return nil
	}
	app.Commands = []cli.Command{
		commandLs,
		commandMkalbum,
		commandUpload,
		commandCopy,
		commandRm,
		commandDebug,
	}
	app.Run(os.Args)
}