Skip to content

Commit

Permalink
Update generate varfile output
Browse files Browse the repository at this point in the history
  • Loading branch information
angrycub committed Sep 25, 2023
1 parent be4312e commit cb94dcc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions internal/creator/templates/pack_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ search for Consul services with the tags found in the default value of the

<!-- Include information on the variables from your pack -->

- `message` (string) - The message your application will respond with
- `count` (number) - The number of app instances to deploy
- `message` (string:"Hello World!") - The message your application will respond with
- `count` (number:2) - The number of app instances to deploy
- `job_name` (string) - The name to use as the job name which overrides using
the pack name
- `datacenters` (list of strings) - A list of datacenters in the region which
- `datacenters` (list of strings:["dc1"]) - A list of datacenters in the region which
are eligible for task placement
- `region` (string) - The region where jobs will be deployed
- `register_consul_service` (bool) - If you want to register a consul service
- `register_consul_service` (bool: true) - If you want to register a Consul service
for the job
- `consul_service_tags` (list of string) - The consul service name for the
- `consul_service_tags` (list of string) - The Consul service name for the
{{.PackName}} application
- `consul_service_name` (string) - The consul service name for the {{.PackName}}
- `consul_service_name` (string) - The Consul service name for the {{.PackName}}
application

[pack-registry]: https://github.com/hashicorp/nomad-pack-community-registry
Expand Down
6 changes: 3 additions & 3 deletions sdk/pack/variables/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (v *Variable) Equal(ivp *Variable) bool {

func (v *Variable) AsOverrideString(pID pack.ID) string {
var out strings.Builder
out.WriteString(fmt.Sprintf(`# variable "%s.%s"`, pID, v.Name))
out.WriteString(fmt.Sprintf(`# variable "%s"`, v.Name))
out.WriteByte('\n')
if v.hasDescription {
tmp := "description: " + v.Description
Expand All @@ -97,9 +97,9 @@ func (v *Variable) AsOverrideString(pID pack.ID) string {
}

if v.Value.Equals(v.Default).True() {
out.WriteString(fmt.Sprintf("#\n# %s.%s=%s\n\n", pID, v.Name, printDefault(v.Default)))
out.WriteString(fmt.Sprintf("#\n# %s=%s\n\n", v.Name, printDefault(v.Default)))
} else {
out.WriteString(fmt.Sprintf("#\n%s.%s=%s\n\n", pID, v.Name, printDefault(v.Value)))
out.WriteString(fmt.Sprintf("#\n%s=%s\n\n", v.Name, printDefault(v.Value)))
}

out.WriteString("\n")
Expand Down

0 comments on commit cb94dcc

Please sign in to comment.