Skip to content

Commit

Permalink
Make dependency source sources optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Jan 17, 2020
1 parent cb3fd18 commit 1757af4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pkg/config/hclconf/dsl_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ type GitTags struct {
}

type GitHubTags struct {
Host string `hcl:"host,attr"`
Source string `hcl:"source,attr"`
Host *string `hcl:"host,attr"`
Source string `hcl:"source,attr"`
}

type GitHubReleases struct {
Host string `hcl:"host,attr"`
Source string `hcl:"source,attr"`
Host *string `hcl:"host,attr"`
Source string `hcl:"source,attr"`
}

type DockerImageTags struct {
Expand Down
12 changes: 10 additions & 2 deletions pkg/variantmod/load_hcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ func appToModule(app *hclconf.App) (*confapi.Module, error) {
if err := gohcl.DecodeBody(d.BodyForType, &hcl.EvalContext{}, &e); err != nil {
return nil, err
}
var host string
if e.Host != nil {
host = *e.Host
}
provider.GitHubTags = confapi.GitHubTags{
Host: e.Host,
Host: host,
Source: func(_ map[string]interface{}) (string, error) {
return e.Source, nil
},
Expand All @@ -71,8 +75,12 @@ func appToModule(app *hclconf.App) (*confapi.Module, error) {
if err := gohcl.DecodeBody(d.BodyForType, &hcl.EvalContext{}, &e); err != nil {
return nil, err
}
var host string
if e.Host != nil {
host = *e.Host
}
provider.GitHubReleases = confapi.GitHubReleases{
Host: e.Host,
Host: host,
Source: func(_ map[string]interface{}) (string, error) {
return e.Source, nil
},
Expand Down

0 comments on commit 1757af4

Please sign in to comment.