Chad Maycumber
Chad Maycumber•2y ago

Running convex run in a CI environment

Can I run convex run in a CI environment without logging in? Maybe there's a way to expose an auth token here? The reason for this is running my migrations when the convex funcitons successfully deploy
8 Replies
ballingt
ballingt•2y ago
convex run will use the CONVEX_DEPLOY_KEY environment variable, so this should work the same as a deploy. (it also unofficially accepts a --url and using the --admin-key flag to pass a deploy key, explicitly this won't go away but it is not in help) it sounds it would be helpful for it to accept a deploy key as well.
Chad Maycumber
Chad MaycumberOP•2y ago
Ahhh nice thanks @ballingt Is the admin key exposed rn? It doesn't seem to have a place in the dash
ballingt
ballingt•2y ago
Ah no not really, the admin key is the credential for login that grants access to your entire account, you can find it in .convex/config.json in your home directory. To avoid using the admin key for this you could make your migration a public mutation and require a password, e.g. a value you deploy to your instance as an environment variable or hardcoded secret
Chad Maycumber
Chad MaycumberOP•2y ago
Ahh gotcha cool that's a neat idea I can do that
ballingt
ballingt•2y ago
@Chad Maycumber @lee just pointed out to me that you can use the deploy key as a more limited scope admin key! If the CONVEX_DEPLOY_KEY environment variable is set this should just work without any flags, so npx convex run --prod --no-push migrations:myInternalMigration
Chad Maycumber
Chad MaycumberOP•2y ago
🔥 Not sure this is working for me. Try to shoot over a screenshot but I'm still getting prompted for a login even when CONVEX_DEPLOY_KEY is defined in the environment
ballingt
ballingt•2y ago
Ah you're right, I has a confused test setup! @Chad Maycumber sorry about this! We'll make this work with a CONVEX_DEPLOY_KEY envvar, that's very sensible.
Chad Maycumber
Chad MaycumberOP•2y ago
Cool that would be awesome

Did you find this page helpful?