示例#1
0
// populateContext sets the required CLI arguments to the context
func (projectFactory projectFactory) populateContext(ecsContext *ecscompose.Context, cliContext *cli.Context) error {
	// populate CLI context
	populate(ecsContext, cliContext)
	ecsContext.CLIContext = cliContext

	// reads and sets the parameters (required to create ECS Service Client) from the cli context to ecs context
	rdwr, err := config.NewReadWriter()
	if err != nil {
		utils.LogError(err, "Error loading config")
		return err
	}
	params, err := config.NewCliParams(cliContext, rdwr)
	if err != nil {
		utils.LogError(err, "Unable to create an instance of ECSParams given the cli context")
		return err
	}
	ecsContext.ECSParams = params

	// populate libcompose context
	if err = projectFactory.populateLibcomposeContext(ecsContext); err != nil {
		return err
	}

	return nil
}
示例#2
0
// populateLibcomposeContext sets the required Libcompose lookup utilities to the context
func (projectFactory projectFactory) populateLibcomposeContext(ecsContext *ecscompose.Context) error {
	envLookup, err := utils.GetDefaultEnvironmentLookup()
	if err != nil {
		return err
	}
	ecsContext.EnvironmentLookup = envLookup

	resourceLookup, err := utils.GetDefaultResourceLookup()
	if err != nil {
		return err
	}
	ecsContext.ResourceLookup = resourceLookup
	return nil
}
示例#3
0
// populate updates the specified ecs context based on command line arguments and subcommands.
func populate(ecsContext *ecscompose.Context, cliContext *cli.Context) {
	// TODO: Support multiple compose files
	ecsContext.ComposeFiles = []string{cliContext.GlobalString(composeFileNameFlag)}
	ecsContext.ProjectName = cliContext.GlobalString(ecscompose.ProjectNameFlag)
}
示例#4
0
// populate updates the specified ecs context based on command line arguments and subcommands.
func populate(ecsContext *ecscompose.Context, cliContext *cli.Context) {
	ecsContext.ComposeFile = cliContext.GlobalString(composeFileNameFlag)
	ecsContext.ProjectName = cliContext.GlobalString(projectNameFlag)
}