-
Notifications
You must be signed in to change notification settings - Fork 10
/
types.go
52 lines (48 loc) · 2.07 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (C) 2022 Appvia Ltd <info@appvia.io>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
RR along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cmd
// Config is the configuration for the tnctl command
type Config struct {
// Workflow is the location of the workflow templates. This should point
// the git repository that contains the templates. It is assumed the user
// consuming these templates already has access the repository setup on
// the machine and able to clone.
// Example: https://github.com/appvia/terranetes-workflows. Note, if a
// ref=TAG is not set, we will query the repository for the latest tag
// (Github only)
Workflow string `json:"workflow,omitempty"`
// Sources defines a list of sources which the search command should
// search terraform modules from. Currently we support the public
// terraform registry and any Github user or organization.
Sources []string `json:"sources,omitempty" yaml:"sources,omitempty"`
}
// ConfigInterface is the interface that must be implemented by the config struct
type ConfigInterface interface {
// GetConfig returns the config for the cli if available
GetConfig() (Config, error)
// HasConfig return true if the config has been defined
HasConfig() (bool, error)
// SaveConfig saves the configuration to the file
SaveConfig(Config) error
}
// NewDefaultConfig returns a default configuration
func NewDefaultConfig() *Config {
return &Config{
Workflow: "https://github.com/appvia/terranetes-workflows",
Sources: []string{"https://registry.terraform.io"},
}
}