@@ -9,11 +9,11 @@ import (
99)
1010
1111type ZeroProjectConfig struct {
12- Name string
12+ Name string `yaml:"name"`
1313 ShouldPushRepositories bool
1414 Infrastructure Infrastructure // TODO simplify and flatten / rename?
1515 Parameters map [string ]string
16- Modules [] string
16+ Modules Modules `yaml:"modules"`
1717}
1818
1919type Infrastructure struct {
@@ -30,6 +30,20 @@ type terraform struct {
3030 RemoteState bool
3131}
3232
33+ type Modules map [string ]Module
34+
35+ type Module struct {
36+ Parameters Parameters `yaml:"parameters"`
37+ Files Files `yaml:"files"`
38+ }
39+
40+ type Parameters map [string ]string
41+
42+ type Files struct {
43+ Directory string `yaml:"dir,omitempty"`
44+ Repository string `yaml:"repo,omitempty"`
45+ }
46+
3347func LoadConfig (filePath string ) * ZeroProjectConfig {
3448 config := & ZeroProjectConfig {}
3549 data , err := ioutil .ReadFile (filePath )
@@ -47,3 +61,36 @@ func LoadConfig(filePath string) *ZeroProjectConfig {
4761func (c * ZeroProjectConfig ) Print () {
4862 pp .Println (c )
4963}
64+
65+ // @TODO only an example, needs refactoring
66+ func EKSGoReactSampleModules () Modules {
67+ parameters := Parameters {}
68+ return Modules {
69+ "zero-aws-eks-stack" : NewModule (parameters , "zero-aws-eks-stack" , "github.com/commitdev/zero-aws-eks-stack" ),
70+ "zero-deployable-backend" : NewModule (parameters , "zero-deployable-backend" , "github.com/commitdev/zero-deployable-backend" ),
71+ "zero-deployable-react-frontend" : NewModule (parameters , "zero-deployable-react-frontend" , "github.com/commitdev/zero-deployable-react-frontend" ),
72+ }
73+ }
74+
75+ // @TODO only an example, needs refactoring
76+ func InfrastructureSampleModules () Modules {
77+ parameters := Parameters {
78+ "repoName" : "infrastructure" ,
79+ "region" : "us-east-1" ,
80+ "accountId" : "12345" ,
81+ "productionHost" : "something.com" ,
82+ }
83+ return Modules {
84+ "infrastructure" : NewModule (parameters , "infrastructure" , "https://github.com/myorg/infrastructure" ),
85+ }
86+ }
87+
88+ func NewModule (parameters Parameters , directory string , repository string ) Module {
89+ return Module {
90+ Parameters : parameters ,
91+ Files : Files {
92+ Directory : directory ,
93+ Repository : repository ,
94+ },
95+ }
96+ }
0 commit comments