示例#1
0
文件: compose.go 项目: dnephin/dobi
// Resolve resolves variables in the resource
func (c *ComposeConfig) Resolve(env *execenv.ExecEnv) (Resource, error) {
	conf := *c
	var err error
	conf.Files, err = env.ResolveSlice(c.Files)
	if err != nil {
		return &conf, err
	}
	conf.Project, err = env.Resolve(c.Project)
	return &conf, err
}
示例#2
0
文件: mount.go 项目: dnephin/dobi
// Resolve resolves variables in the resource
func (c *MountConfig) Resolve(env *execenv.ExecEnv) (Resource, error) {
	conf := *c
	var err error
	conf.Path, err = env.Resolve(c.Path)
	if err != nil {
		return &conf, err
	}
	conf.Bind, err = fs.ExpandUser(c.Bind)
	return &conf, err
}
示例#3
0
文件: env.go 项目: dnephin/dobi
// Resolve resolves variables in the config
func (c *EnvConfig) Resolve(env *execenv.ExecEnv) (Resource, error) {
	conf := *c
	var err error

	conf.Files, err = env.ResolveSlice(c.Files)
	if err != nil {
		return &conf, err
	}

	conf.Variables, err = env.ResolveSlice(c.Variables)
	return &conf, err
}
示例#4
0
文件: image.go 项目: dnephin/dobi
// Resolve resolves variables in the resource
func (c *ImageConfig) Resolve(env *execenv.ExecEnv) (Resource, error) {
	conf := *c
	var err error
	conf.Tags, err = env.ResolveSlice(c.Tags)
	if err != nil {
		return &conf, err
	}

	for key, value := range c.Args {
		conf.Args[key], err = env.Resolve(value)
		if err != nil {
			return &conf, err
		}
	}
	return &conf, nil
}
示例#5
0
文件: job.go 项目: dnephin/dobi
// Resolve resolves variables in the resource
func (c *JobConfig) Resolve(env *execenv.ExecEnv) (Resource, error) {
	conf := *c
	var err error
	conf.Env, err = env.ResolveSlice(c.Env)
	if err != nil {
		return &conf, err
	}
	conf.WorkingDir, err = env.Resolve(c.WorkingDir)
	if err != nil {
		return &conf, err
	}
	conf.User, err = env.Resolve(c.User)
	if err != nil {
		return &conf, err
	}
	conf.NetMode, err = env.Resolve(c.NetMode)
	return &conf, err
}