fix: Print postgres-builtin-url to stdout without formatting (#3727)

This allows use-cases like `eval $(coder server postgres-builtin-url)`.
This commit is contained in:
Mathias Fredriksson
2022-08-29 11:37:18 +00:00
committed by GitHub
parent b9b9c2fb9f
commit f4c5020f63
+2 -2
View File
@@ -659,13 +659,13 @@ func Server(newAPI func(*coderd.Options) *coderd.API) *cobra.Command {
root.AddCommand(&cobra.Command{
Use: "postgres-builtin-url",
Short: "Output the connection URL for the built-in PostgreSQL deployment.",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
cfg := createConfig(cmd)
url, err := embeddedPostgresURL(cfg)
if err != nil {
return err
}
cmd.Println(cliui.Styles.Code.Render("psql \"" + url + "\""))
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "psql %q\n", url)
return nil
},
})