1
// Copyright 2012, 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
9
"launchpad.net/gnuflag"
11
"launchpad.net/juju-core/cmd"
12
"launchpad.net/juju-core/store"
15
// ConfigCommand defines a command which requires a YAML config file.
16
type ConfigCommand struct {
22
type CharmdConfig struct {
23
MongoUrl string `yaml:"mongo-url"`
26
func (c *ConfigCommand) SetFlags(f *gnuflag.FlagSet) {
27
f.StringVar(&c.ConfigPath, "config", "", "charmd configuration file")
30
func (c *ConfigCommand) Init(args []string) error {
31
if c.ConfigPath == "" {
32
return fmt.Errorf("--config is required")
37
func (c *ConfigCommand) ReadConfig(ctx *cmd.Context) (err error) {
38
c.Config, err = store.ReadConfig(ctx.AbsPath(c.ConfigPath))