Skip to content

Commit

Permalink
builder: remove atlas.env from the generated config
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm committed Sep 9, 2024
1 parent 5323bfd commit 85de4e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions internal/provider/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type (
)

// we will allow the user configure the base atlas.hcl file
const baseAtlasHCL = "env {\n}"
const baseAtlasHCL = "env {\n name = atlas.env\n}"

// Render writes the atlas config to the given writer.
func (c *projectConfig) Render(w io.Writer) error {
Expand Down Expand Up @@ -83,10 +83,6 @@ func (c *projectConfig) File() *hclwrite.File {
}
if env := c.Env; env != nil {
e := r.AppendNewBlock("env", nil).Body()
e.SetAttributeTraversal("name", hcl.Traversal{
hcl.TraverseRoot{Name: "atlas"},
hcl.TraverseAttr{Name: "env"},
})
if env.URL != "" {
e.SetAttributeValue("url", cty.StringVal(env.URL))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func Test_SchemaTemplate(t *testing.T) {
out := &bytes.Buffer{}
require.NoError(t, data.Render(out))
require.Equal(t, `env {
dev = "mysql://user:pass@localhost:3307/tf-db"
name = atlas.env
dev = "mysql://user:pass@localhost:3307/tf-db"
src = "file://schema.hcl"
url = "mysql://user:pass@localhost:3306/tf-db"
diff {
Expand Down

0 comments on commit 85de4e7

Please sign in to comment.