forked from TrueCloudLab/certificates
change name of package cli-utils/config to cli-utils/step
This commit is contained in:
parent
62a20c7db5
commit
741ac64c61
3 changed files with 16 additions and 13 deletions
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/smallstep/certificates/api"
|
"github.com/smallstep/certificates/api"
|
||||||
"go.step.sm/cli-utils/config"
|
"go.step.sm/cli-utils/step"
|
||||||
"go.step.sm/crypto/pemutil"
|
"go.step.sm/crypto/pemutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ const TunnelTLS Type = "tTLS"
|
||||||
const DefaultLeeway = 1 * time.Minute
|
const DefaultLeeway = 1 * time.Minute
|
||||||
|
|
||||||
// IdentityFile contains the location of the identity file.
|
// IdentityFile contains the location of the identity file.
|
||||||
var IdentityFile = filepath.Join(config.StepPath(), "config", "identity.json")
|
var IdentityFile = filepath.Join(step.Path(), "config", "identity.json")
|
||||||
|
|
||||||
// DefaultsFile contains the location of the defaults file.
|
// DefaultsFile contains the location of the defaults file.
|
||||||
var DefaultsFile = filepath.Join(config.StepPath(), "config", "defaults.json")
|
var DefaultsFile = filepath.Join(step.Path(), "config", "defaults.json")
|
||||||
|
|
||||||
// Identity represents the identity file that can be used to authenticate with
|
// Identity represents the identity file that can be used to authenticate with
|
||||||
// the CA.
|
// the CA.
|
||||||
|
@ -80,8 +80,8 @@ func LoadDefaultIdentity() (*Identity, error) {
|
||||||
// configDir and identityDir are used in WriteDefaultIdentity for testing
|
// configDir and identityDir are used in WriteDefaultIdentity for testing
|
||||||
// purposes.
|
// purposes.
|
||||||
var (
|
var (
|
||||||
configDir = filepath.Join(config.StepPath(), "config")
|
configDir = filepath.Join(step.Path(), "config")
|
||||||
identityDir = filepath.Join(config.StepPath(), "identity")
|
identityDir = filepath.Join(step.Path(), "identity")
|
||||||
)
|
)
|
||||||
|
|
||||||
// WriteDefaultIdentity writes the given certificates and key and the
|
// WriteDefaultIdentity writes the given certificates and key and the
|
||||||
|
|
11
go.mod
11
go.mod
|
@ -44,7 +44,10 @@ require (
|
||||||
gopkg.in/square/go-jose.v2 v2.6.0
|
gopkg.in/square/go-jose.v2 v2.6.0
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace github.com/smallstep/nosql => ../nosql
|
//replace github.com/smallstep/nosql => ../nosql
|
||||||
// replace go.step.sm/crypto => ../crypto
|
|
||||||
// replace go.step.sm/cli-utils => ../cli-utils
|
//replace go.step.sm/crypto => ../crypto
|
||||||
// replace go.step.sm/linkedca => ../linkedca
|
|
||||||
|
replace go.step.sm/cli-utils => ../cli-utils
|
||||||
|
|
||||||
|
replace go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 => github.com/omorsi/pkcs7 v0.0.0-20210217142924-a7b80a2a8568
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
|
|
||||||
"github.com/Masterminds/sprig/v3"
|
"github.com/Masterminds/sprig/v3"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"go.step.sm/cli-utils/config"
|
|
||||||
"go.step.sm/cli-utils/fileutil"
|
"go.step.sm/cli-utils/fileutil"
|
||||||
|
"go.step.sm/cli-utils/step"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TemplateType defines how a template will be written in disk.
|
// TemplateType defines how a template will be written in disk.
|
||||||
|
@ -132,7 +132,7 @@ func (t *Template) Validate() error {
|
||||||
|
|
||||||
if t.TemplatePath != "" {
|
if t.TemplatePath != "" {
|
||||||
// Check for file
|
// Check for file
|
||||||
st, err := os.Stat(config.StepAbs(t.TemplatePath))
|
st, err := os.Stat(step.Abs(t.TemplatePath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading %s", t.TemplatePath)
|
return errors.Wrapf(err, "error reading %s", t.TemplatePath)
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ func (t *Template) Load() error {
|
||||||
if t.Template == nil && t.Type != Directory {
|
if t.Template == nil && t.Type != Directory {
|
||||||
switch {
|
switch {
|
||||||
case t.TemplatePath != "":
|
case t.TemplatePath != "":
|
||||||
filename := config.StepAbs(t.TemplatePath)
|
filename := step.Abs(t.TemplatePath)
|
||||||
b, err := ioutil.ReadFile(filename)
|
b, err := ioutil.ReadFile(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error reading %s", filename)
|
return errors.Wrapf(err, "error reading %s", filename)
|
||||||
|
@ -247,7 +247,7 @@ type Output struct {
|
||||||
|
|
||||||
// Write writes the Output to the filesystem as a directory, file or snippet.
|
// Write writes the Output to the filesystem as a directory, file or snippet.
|
||||||
func (o *Output) Write() error {
|
func (o *Output) Write() error {
|
||||||
path := config.StepAbs(o.Path)
|
path := step.Abs(o.Path)
|
||||||
if o.Type == Directory {
|
if o.Type == Directory {
|
||||||
return mkdir(path, 0700)
|
return mkdir(path, 0700)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue