func Staging()

in ccadb2OneCRL/main.go [161:178]


func Staging() (*kinto.Client, error) {
	staging := oneCRLStagingDefault
	if os.Getenv(OneCRLStaging) != "" {
		staging = os.Getenv(OneCRLStaging)
	}
	c, err := kinto.NewClientFromStr(staging)
	if err != nil {
		return nil, errors.Wrap(err, "failed to construct OneCRL staging client from URL")
	}
	principal, err := KintoPrincipal(
		os.Getenv(OneCRLStagingUser),
		os.Getenv(OneCRLStagingPassword),
		os.Getenv(OneCRLStagingToken))
	if err != nil {
		return nil, errors.Wrap(err, "failed to set OneCRL staging credentials")
	}
	return c.WithAuthenticator(principal), nil
}