mach-composer / mach-composer-cli

MACH composer is an orchestration tool for modern MACH ecosystems, powered by Terraform infrastructure-as-code underneath.
https://docs.machcomposer.io
MIT License
48 stars 10 forks source link

Allow for cloud login to complete without a browser #397

Open rio opened 5 months ago

rio commented 5 months ago

Currently the cli assumes that it can open a browser on the user's behalf when running cloud login which almost always not available in CI environments. Unless I'm missing some configuration option, it seems a --open-browser=false flag would be desirable to facilitate CI workflows or other use cases where access to xdg-open or other ways of opening a user's browser is not available.

demeyerthom commented 5 months ago

@rio you can set MCC_CLIENT_ID and MCC_CLIENT_SECRET to override this logic entirely. If those are set it will authenticate on its own. We run the CLI in the pipeline in the same way.

The credentials can be found on the MC Cloud Dashboard under settings. See https://docs.machcomposer.io/cloud/getting-started.html also

rio commented 5 months ago

I knew I was missing something ;)

Still, it would be healthy to just print the URL and wait for the auth code if it was unable to open the browser. I might whip up something but I'm a bit swamped currently.

I'll leave this open for now.

demeyerthom commented 5 months ago

That is fair, if we have no creds set and don't open a browser we should just error out instead. That way at least the user knows what is going on. If you want to take a look feel free, I will otherwise set it on the backlog