Skip to content

Commit

Permalink
Make the exposed LoadBuildConfigFromFile a method on DockerBuildConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Razieh Behjati <[email protected]>
  • Loading branch information
rbehjati committed Dec 20, 2022
1 parent 703bea1 commit 9db3d71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion internal/builders/docker/pkg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ func (d *Digest) ToMap() map[string]string {
}

// LoadBuildConfigFromFile loads build configuration from a toml file in the given path and returns an instance of BuildConfig.
func LoadBuildConfigFromFile(path string) (*BuildConfig, error) {
func (dbc *DockerBuildConfig) LoadBuildConfigFromFile() (*BuildConfig, error) {
return loadBuildConfigFromFile(dbc.BuildConfigPath)
}

func loadBuildConfigFromFile(path string) (*BuildConfig, error) {
tomlTree, err := toml.LoadFile(path)
if err != nil {
return nil, fmt.Errorf("couldn't load toml file: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/builders/docker/pkg/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

func Test_LoadBuildConfigFromFile(t *testing.T) {
got, err := LoadBuildConfigFromFile("../testdata/config.toml")
got, err := loadBuildConfigFromFile("../testdata/config.toml")
if err != nil {
t.Fatalf("couldn't load config file: %v", err)
}
Expand Down

0 comments on commit 9db3d71

Please sign in to comment.