Пример #1
0
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
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
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)
}