コード例 #1
0
ファイル: gonduit_test.go プロジェクト: Exquance/phabulous
func getConfig() *confer.Config {
	c := confer.NewConfig()

	c.Set("mist.ignore-ca", false)

	return c
}
コード例 #2
0
ファイル: config.go プロジェクト: derekdowling/pantry-api
// Load configuration data.
func load() *confer.Config {
	// Load the config
	App = confer.NewConfig()
	App.SetRootPath(getLoadPath())
	if errs := App.ReadPaths(getConfigPaths()...); errs != nil {
		fmt.Println(errs)
	}
	return App
}
コード例 #3
0
ファイル: config.go プロジェクト: caihua-yin/hello-go
// LoadConfigs loads configs from the list of files
func LoadConfigs(configFiles ...string) *confer.Config {
	config := confer.NewConfig()

	log.Printf("Loading config from %v...", configFiles)
	err := config.ReadPaths(configFiles...)
	if err != nil {
		log.Fatalf("unable to read configuration: %s", err)
	}

	return config
}
コード例 #4
0
ファイル: run_context.go プロジェクト: dom4tools/dom4tools
func (runContext *RunContext) Finalize() error {
	gameInstallation := game.NewGameInstallation(runContext.BasePath)

	runContext.GameInstallation = *gameInstallation

	config := confer.NewConfig()
	config.ReadPaths(runContext.BaseConfigurationPath)
	runContext.Config = config

	return nil
}
コード例 #5
0
ファイル: config.go プロジェクト: bernos/go-restapi
func loadConfig() *confer.Config {
	config := confer.NewConfig()
	appenv := os.Getenv("GO_APPENV")
	paths := []string{"application.yml"}

	if appenv != "" {
		paths = append(paths, fmt.Sprintf("application.%s.yml", appenv))
	}

	if err := config.ReadPaths(paths...); err != nil {
		log.Warn(err)
	}

	return config
}
コード例 #6
0
ファイル: config.go プロジェクト: Pholey/distribuTor
func init() {
	File = confer.NewConfig()
	appenv := os.Getenv("DISTRIBUTOR_ENV")
	configPath := fmt.Sprintf("%s", os.Getenv("GOPATH")) + "/src/github.com/Pholey/distribuTor/config/"

	// Default to default configs if no environment is set
	paths := []string{configPath + "application.yml", configPath + "development.yml"}

	// $EXGO_ENV should be one of "production", "development" or "test"
	if appenv != "" {
		paths = append(paths, configPath+fmt.Sprintf("%s.yml", appenv))
	}

	// Override other config with local config
	paths = append(paths, configPath+"local.yml")

	if err := File.ReadPaths(paths...); err != nil {
		panic(err)
	}
}
コード例 #7
0
ファイル: conf.go プロジェクト: tolexo/aero
func loadDefaultConfig() {
	configuration = confer.NewConfig()
	seek := []string{
		"production.yaml",
		"dev.yaml",
		"config.yaml",
		"./config/production.yaml",
		"./config/dev.yaml",
		"./config/config.yaml",
	}
	var err error
	for _, file := range seek {
		err := configuration.ReadPaths(file)
		if err == nil {
			abs, _ := filepath.Abs(file)
			fmt.Println("Configuration loaded:", abs)
			break
		}
	}
	if err != nil {
		fmt.Println("No configuration file found")
	}
}
コード例 #8
0
ファイル: phabulous.go プロジェクト: kronion/phabulous
func main() {
	// Create the configuration
	// In this case, we will be using the environment and some safe defaults
	config := confer.NewConfig()
	config.ReadPaths("config/main.yml", "config/main.production.yml")
	config.AutomaticEnv()

	// Next, we setup the dependency graph
	// In this example, the graph won't have many nodes, but on more complex
	// applications it becomes more useful.
	var g inject.Graph
	var phabulous app.Phabulous
	g.Provide(
		&inject.Object{Value: config},
		&inject.Object{Value: &phabulous},
	)
	if err := g.Populate(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	// Boot the upper layers of the app.
	phabulous.Boot()

	// Setup the command line application
	app := cli.NewApp()
	app.Name = "phabulous"
	app.Usage = "A Phabricator bot in Go"

	// Set version and authorship info
	app.Version = "2.1.0-alpha1"
	app.Author = "Eduardo Trujillo <*****@*****.**>"

	// Setup the default action. This action will be triggered when no
	// subcommand is provided as an argument
	app.Action = func(c *cli.Context) {
		fmt.Println("Usage: phabulous [global options] command [command options] [arguments...]")
	}

	app.Commands = []cli.Command{
		{
			Name:    "serve",
			Aliases: []string{"s", "server", "listen"},
			Usage:   "Start the API server",
			Action:  phabulous.Serve.Run,
		},
		{
			Name: "slack",
			Subcommands: []cli.Command{
				{
					Name:   "test",
					Usage:  "Test that the slackbot works",
					Action: phabulous.SlackWorkbench.SendTestMessage,
				},
				{
					Name:   "resolve.commit",
					Usage:  "Test that that a commit can correctly be resolved into a channel",
					Action: phabulous.SlackWorkbench.ResolveCommitChannel,
				},
				{
					Name:   "resolve.task",
					Usage:  "Test that that a task can correctly be resolved into a channel",
					Action: phabulous.SlackWorkbench.ResolveTaskChannel,
				},
				{
					Name:   "resolve.revision",
					Usage:  "Test that that a revision can correctly be resolved into a channel",
					Action: phabulous.SlackWorkbench.ResolveRevisionChannel,
				},
			},
		},
	}

	// Begin
	app.Run(os.Args)
}
コード例 #9
0
ファイル: phabulous.go プロジェクト: Exquance/phabulous
func main() {
	// Seed rand.
	rand.Seed(time.Now().UTC().UnixNano())

	// Create the configuration
	// In this case, we will be using the environment and some safe defaults
	config := confer.NewConfig()
	config.ReadPaths("config/main.yml", "config/main.production.yml")
	config.AutomaticEnv()

	// Create the logger.
	logger := logrus.New()

	// Next, we setup the dependency graph
	// In this example, the graph won't have many nodes, but on more complex
	// applications it becomes more useful.
	var g inject.Graph
	var phabulous app.Phabulous
	g.Provide(
		&inject.Object{Value: config},
		&inject.Object{Value: &phabulous},
		&inject.Object{Value: logger},
	)
	if err := g.Populate(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	// Setup the command line application
	app := cli.NewApp()
	app.Name = "phabulous"
	app.Usage = "A Phabricator bot in Go"

	// Set version and authorship info
	app.Version = "2.1.0-alpha1"
	app.Author = "Eduardo Trujillo <*****@*****.**>"

	// Setup the default action. This action will be triggered when no
	// subcommand is provided as an argument
	app.Action = func(c *cli.Context) {
		fmt.Println("Usage: phabulous [global options] command [command options] [arguments...]")
	}

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "config",
			Usage: "Provide an alternative configuration file",
		},
	}

	app.Commands = []cli.Command{
		{
			Name:    "serve",
			Aliases: []string{"s", "server", "listen"},
			Usage:   "Start the API server",
			Action:  phabulous.Serve.Run,
		},
	}

	// Begin
	app.Run(os.Args)
}
コード例 #10
0
ファイル: arcana.go プロジェクト: etcinit/arcana
func main() {
	// Create the configuration
	// In this case, we will be using the environment and some safe defaults
	config := confer.NewConfig()
	config.ReadPaths("config/main.yml", "config/main.production.yml")
	config.AutomaticEnv()

	// Next, we setup the dependency graph
	// In this example, the graph won't have many nodes, but on more complex
	// applications it becomes more useful.
	var g inject.Graph
	var arcana app.Arcana
	g.Provide(
		&inject.Object{Value: config},
		&inject.Object{Value: &arcana},
	)
	if err := g.Populate(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	// Boot the upper layers of the app.
	arcana.Boot()

	// Setup the command line application
	app := cli.NewApp()
	app.Name = "arcana"
	app.Usage = "A Phabricator Conduit CLI in Go"

	// Set version and authorship info
	app.Version = "0.0.1"
	app.Author = "Eduardo Trujillo <*****@*****.**>"

	// Setup the default action. This action will be triggered when no
	// subcommand is provided as an argument
	app.Action = func(c *cli.Context) {
		fmt.Println("Usage: arcana [global options] command [command options] [arguments...]")
	}

	app.Commands = []cli.Command{
		{
			Name:        "diffusion",
			Description: "Perform calls to diffusion conduit endpoints",
			Subcommands: []cli.Command{
				{
					Name:   "querycommits.name",
					Usage:  "Query commits by name",
					Action: arcana.Diffusion.QueryCommitsByName,
				},
			},
		},
		{
			Name:        "repository",
			Description: "Perform calls to repository conduit endpoints",
			Subcommands: []cli.Command{
				{
					Name:   "query.callsign",
					Usage:  "Query repositories by callsign",
					Action: arcana.Repository.QueryByCallsign,
				},
			},
		},
		{
			Name:        "maniphest",
			Aliases:     []string{"tasks"},
			Description: "Perform calls to maniphest conduit endpoints",
			Subcommands: []cli.Command{
				{
					Name:   "query.ids",
					Usage:  "Query tasks by ids (1, 2, 3, etc)",
					Action: arcana.Maniphest.QueryByIDs,
				},
				{
					Name:   "query.phids",
					Usage:  "Query tasks by their phids",
					Action: arcana.Maniphest.QueryByPHIDs,
				},
			},
		},
	}

	// Begin
	app.Run(os.Args)
}