Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Suffix -> prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshVanL committed Jun 27, 2018
1 parent 2cc535e commit f3f9f3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmd/tarmak/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ func init() {
)

RootCmd.PersistentFlags().StringSliceVar(
&globalFlags.ConfigSuffixes,
"config-suffixes",
&globalFlags.ConfigPrefixes,
"config-prefixes",
[]string{
"tarmak",
"cluster",
"environment",
"provider",
},
"set suffixes of files containing tarmak configuration",
"set prefixes of files containing tarmak configuration to be used",
)

if version == "dev" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/tarmak/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type Flags struct {

WingDevMode bool // use a bundled wing version rather than a tagged release from GitHub

ConfigSuffixes []string // the suffixes used for imported configuration fragments
ConfigPrefixes []string // the prefixes used for imported configuration fragments
}

// This contains the cluster specifc operation flags
Expand Down
8 changes: 4 additions & 4 deletions pkg/tarmak/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func (c *Config) configPath() string {
func (c *Config) ReadConfig() (*tarmakv1alpha1.Config, error) {
var config *tarmakv1alpha1.Config

configBytes, err := c.readConfigFragments(c.flags.ConfigSuffixes)
configBytes, err := c.readConfigFragments(c.flags.ConfigPrefixes)
if err != nil {
return nil, fmt.Errorf("failed to read tarmak configs: %v", err)
}
Expand All @@ -342,7 +342,7 @@ func (c *Config) ReadConfig() (*tarmakv1alpha1.Config, error) {
return config, nil
}

func (c *Config) readConfigFragments(suffixes []string) ([]byte, error) {
func (c *Config) readConfigFragments(prefixes []string) ([]byte, error) {
dir, err := ioutil.ReadDir(c.tarmak.ConfigPath())
if err != nil {
return nil, err
Expand All @@ -352,8 +352,8 @@ func (c *Config) readConfigFragments(suffixes []string) ([]byte, error) {
for _, f := range dir {
if !f.IsDir() && strings.HasSuffix(f.Name(), ".yaml") {

for _, suffix := range suffixes {
if strings.HasPrefix(f.Name(), suffix) {
for _, prefix := range prefixes {
if strings.HasPrefix(f.Name(), prefix) {
fragFiles = append(fragFiles, f)
break
}
Expand Down

0 comments on commit f3f9f3f

Please sign in to comment.