How can I login using atlas config init during a script

Hello !

I’m want to whitelist the IP of my CircleCI runner then delete the IP in the whitelist. The goal is to dump locally my database to use it during test.

The issue is that if I want to use API authentication in CLI I have to use atlas config init and this command will be executed in a script, I can’t prompt the keys during the script. How can I authenticate to Atlas using Atlas CLI without have to manually prompt some credentials?

Hey @Tom_Boscher!

You should be able to do this via a profile.

Save Connection Settings

You can save your frequently-used connection settings as profiles. Profiles store the project IDs, organization IDs, and, optionally, API keys to use in future Atlas CLI sessions. To save time, you can specify a profile instead of using the --projectId and --orgId flags with each command. The Atlas CLI stores your profiles in a configuration file called config.toml .

Thank you for your answer, I saw about profile but isn’t there a solution without having to store a file?

Maybe I’m not following … but how could you write a script that doesn’t prompt for a key, but also somehow has the key without writing that key somewhere (either to a config, or in a script)?

With the right permissions writing the key to a file shouldn’t be a problem, if that is the concern.

My issue is that my CircleCI runner data won’t be persistent so I will have to store the file in my repo and I prefer to avoid this solution for security reason.

EDIT: I found that there is environment variables for Atlas CLI

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.