feat: add YAML support to server (#6934)

This commit is contained in:
Ammar Bandukwala
2023-04-07 17:58:21 -05:00
committed by GitHub
parent a3c6cb1768
commit 4b99e2d07e
32 changed files with 1605 additions and 468 deletions

View File

@ -176,12 +176,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
defer cancel()
if cfg.WriteConfig {
// TODO: this should output to a file.
n, err := opts.ToYAML()
n, err := opts.MarshalYAML()
if err != nil {
return xerrors.Errorf("generate yaml: %w", err)
}
enc := yaml.NewEncoder(inv.Stderr)
enc := yaml.NewEncoder(inv.Stdout)
enc.SetIndent(2)
err = enc.Encode(n)
if err != nil {
return xerrors.Errorf("encode yaml: %w", err)
@ -193,6 +193,10 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
return nil
}
if cfg.Config != "" {
cliui.Warnf(inv.Stderr, "YAML support is experimental and offers no compatibility guarantees.")
}
// Print deprecation warnings.
for _, opt := range opts {
if opt.UseInstead == nil {