Convox Community

What are the options for configuring the Convox host when using the CLI?

I am only aware of the ~/.convox/host file, but are there some other ways to configure the host? Would it be possible to support one of the following?

  • ./.convox/host in the local directory (similar to ./.convox/app) - I’ve tested this and it doesn’t seem to be supported
  • --host flag for the CLI
  • CONVOX_HOST env variable

Sorry if these are already supported, but I couldn’t find anything in the docs.

I use some custom build/deploy scripts, and I have to be careful when deploying to different environments, because ~/.convox/host is a “global” file. My scripts often run multiple convox commands in a sequence. So if a deploy script is running in the “staging” environment, then I can’t do anything in the prod environment until the script has finished. (If I switch the host back to prod, then the script will start running the commands on prod instead of staging.)

It would be great if there was a way to isolate this host option instead of relying on a global file, to ensure that all commands are being run for the correct host.

Thanks!

Ah sorry I found it in the source code!

func currentHost(c *stdcli.Context) (string, error) {
	if h := os.Getenv("CONVOX_HOST"); h != "" {
		return h, nil
	}

	if h, _ := c.SettingRead("host"); h != "" {
		return h, nil
	}

	return "", nil
}

So it looks like ~/.convox/host and the CONVOX_HOST env variable are supported. I can work with that!