2020-05-18 17:48:31 +02:00
|
|
|
package environments
|
|
|
|
|
|
|
|
import (
|
2021-05-25 14:08:27 +02:00
|
|
|
"github.com/woodpecker-ci/woodpecker/model"
|
2020-05-18 17:48:31 +02:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
type builtin struct {
|
|
|
|
globals []*model.Environ
|
|
|
|
}
|
|
|
|
|
|
|
|
// New returns a new local registry service.
|
|
|
|
func Filesystem(params []string) model.EnvironService {
|
|
|
|
var globals []*model.Environ
|
|
|
|
|
|
|
|
for _, item := range params {
|
|
|
|
kvpair := strings.SplitN(item, ":", 2)
|
|
|
|
globals = append(globals, &model.Environ{Name: kvpair[0], Value: kvpair[1]})
|
|
|
|
}
|
|
|
|
return &builtin{globals}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *builtin) EnvironList(repo *model.Repo) ([]*model.Environ, error) {
|
|
|
|
return b.globals, nil
|
|
|
|
}
|