Skip to content

Commit

Permalink
modify ModifyConfig()
Browse files Browse the repository at this point in the history
Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>
  • Loading branch information
rakshitgondwal committed Jul 9, 2024
1 parent 7d85325 commit 7a82f12
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions pkg/hcl2nix/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,17 @@ func ModifyConfig(oldName string, artifact OCIArtifact, config *Config) error {
}
}

if !updated {
config.OCIArtifact = append(config.OCIArtifact, artifact)
}

var buf bytes.Buffer
err := WriteConfig(*config, &buf)
if err != nil {
return err
}
if updated {
var buf bytes.Buffer
err := WriteConfig(*config, &buf)
if err != nil {
return err
}

err = os.WriteFile("bsf.hcl", buf.Bytes(), 0644)
if err != nil {
return err
err = os.WriteFile("bsf.hcl", buf.Bytes(), 0644)
if err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit 7a82f12

Please sign in to comment.