github.com/drone/runner-go@v1.12.0/environ/provider/static.go (about)

     1  // Copyright 2019 Drone.IO Inc. All rights reserved.
     2  // Use of this source code is governed by the Polyform License
     3  // that can be found in the LICENSE file.
     4  
     5  package provider
     6  
     7  import "context"
     8  
     9  // Static returns a new static environment variable provider.
    10  // The static provider finds and returns the static list
    11  // of static environment variables.
    12  func Static(params map[string]string) Provider {
    13  	return &static{params}
    14  }
    15  
    16  type static struct {
    17  	params map[string]string
    18  }
    19  
    20  func (p *static) List(context.Context, *Request) ([]*Variable, error) {
    21  	return ToSlice(p.params), nil
    22  }