Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
  • Loading branch information
AustinAbro321 committed Feb 19, 2025
1 parent 56e636f commit 5f3d238
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
11 changes: 1 addition & 10 deletions site/src/content/docs/ref/config-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Tabs, TabItem, Code } from "@astrojs/starlight/components";

Users can use a config file to easily control flags for `zarf init`, `zarf package create`, and `zarf package deploy` commands, as well as global flags (excluding `--confirm`), enabling a more straightforward and declarative workflow.

Zarf supports config files written in common configuration file formats including `toml`, `json`, `yaml`, `ini` and `props`, and by default Zarf will look for a file called `zarf-config` with one of these filenames in the current working directory. To generate a blank config file you can run `zarf dev generate-config` with an optional output filename/format. For example, to create an empty config file with the `my-cool-env` in the yaml format, you can use `zarf dev generate-config my-cool-env.yaml`.
Zarf supports config files written in `toml` and `yaml`. By default Zarf will look for a file called `zarf-config` with one of these filenames in the current working directory. To generate a blank config file you can run `zarf dev generate-config` with an optional output filename/format. For example, to create an empty config file with the `my-cool-env` in the yaml format, you can use `zarf dev generate-config my-cool-env.yaml`.

To use a custom config filename, set the `ZARF_CONFIG` environment variable to the config file's path. For example, to use the `my-cool-env.yaml` config file in the current working directory, you can set the `ZARF_CONFIG` environment variable to `my-cool-env.yaml`. The `ZARF_CONFIG` environment variable can be set either in the shell or in a `.env` file in the current working directory. Note that the `ZARF_CONFIG` environment variable takes precedence over the default config file path.

Expand All @@ -30,8 +30,6 @@ Zarf searches for the Zarf Config File from either your current working director

import configYaml from "../../../../../examples/config-file/zarf-config.yaml?raw";
import configToml from "../../../../../examples/config-file/zarf-config.toml?raw";
import configIni from "../../../../../examples/config-file/zarf-config.ini?raw";
import configJson from "../../../../../examples/config-file/zarf-config.json?raw";

<Tabs>
<TabItem label="yaml">
Expand All @@ -40,12 +38,6 @@ import configJson from "../../../../../examples/config-file/zarf-config.json?raw
<TabItem label="toml">
<Code code={configToml} lang="toml" title="zarf-config.toml" />
</TabItem>
<TabItem label="ini">
<Code code={configIni} lang="ini" title="zarf-config.ini" />
</TabItem>
<TabItem label="json">
<Code code={configJson} lang="json" title="zarf-config.json" />
</TabItem>
</Tabs>

## Example Package
Expand All @@ -62,4 +54,3 @@ zarf package deploy zarf-package-config-file-<arch>.tar.zst --confirm
```

<Code code={packageConfig} lang="yaml" title="zarf.yaml" />

2 changes: 2 additions & 0 deletions src/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ func (o *devGenerateConfigOptions) run(_ *cobra.Command, args []string) error {
}

v := getViper()
// TODO once other formats are fully deprecated move this to the global viper config
viper.SupportedExts = []string{"toml", "yaml", "yml"}
if err := v.SafeWriteConfigAs(fileName); err != nil {
return fmt.Errorf("unable to write the config file %s, make sure the file doesn't already exist: %w", fileName, err)
}
Expand Down
1 change: 0 additions & 1 deletion src/cmd/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func PrintViperConfigUsed(ctx context.Context) error {
if cfgFile := v.ConfigFileUsed(); cfgFile != "" {
l.Info("using config file", "location", cfgFile)
fileType := strings.TrimPrefix(filepath.Ext(cfgFile), ".")
fmt.Println("file type is", fileType)
if !(fileType == "yml" || fileType == "yaml" || fileType == "toml") {
l.Warn("configuration file types other than YAML and TOML are deprecated and will be removed in a future release", "fileType", fileType)
}
Expand Down

0 comments on commit 5f3d238

Please sign in to comment.