2020-05-18 15:48:31 +00:00
|
|
|
package environments
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
2021-10-12 07:25:13 +00:00
|
|
|
|
|
|
|
"github.com/woodpecker-ci/woodpecker/server/model"
|
2020-05-18 15:48:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type builtin struct {
|
|
|
|
globals []*model.Environ
|
|
|
|
}
|
|
|
|
|
2021-09-28 10:56:59 +00:00
|
|
|
// Filesystem returns a new local registry service.
|
2020-05-18 15:48:31 +00:00
|
|
|
func Filesystem(params []string) model.EnvironService {
|
|
|
|
var globals []*model.Environ
|
|
|
|
|
|
|
|
for _, item := range params {
|
2021-09-28 10:56:59 +00:00
|
|
|
kvPair := strings.SplitN(item, ":", 2)
|
|
|
|
globals = append(globals, &model.Environ{Name: kvPair[0], Value: kvPair[1]})
|
2020-05-18 15:48:31 +00:00
|
|
|
}
|
|
|
|
return &builtin{globals}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *builtin) EnvironList(repo *model.Repo) ([]*model.Environ, error) {
|
|
|
|
return b.globals, nil
|
|
|
|
}
|