Atlas - 1Password shell plugin
One of the initial hurdles I encountered was the learning curve associated with understanding the intricacies of the Atlas CLI and writing effective shell plugins for 1Password.
The Atlas shell plugin uses an API Key as a credential for authentication.
func MongoDBAtlasCLI() schema.Executable {
return schema.Executable{
Name: "MongoDB Atlas CLI",
Runs: []string{"atlas"},
DocsURL: sdk.URL("https://www.mongodb.com/docs/atlas/cli/stable/"),
NeedsAuth: needsauth.IfAll(
needsauth.NotForHelpOrVersion(),
needsauth.NotWithoutArgs(),
),
Uses: []schema.CredentialUsage{
{
Name: credname.APIKey,
},
},
}
}
API Key credential accepts both PrivateKey and PublicKey for executing Atlas CLI commands. I then provision them as environment variables.
//...
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
Importer: importer.TryAll(
importer.TryEnvVarPair(defaultEnvVarMapping),
)}
}
var defaultEnvVarMapping = map[string]sdk.FieldName{
"MONGODB_ATLAS_PUBLIC_API_KEY": fieldname.PublicKey,
"MONGODB_ATLAS_PRIVATE_API_KEY": fieldname.PrivateKey,
}
Thanks to the comprehensive documentation and enlightening video tutorials offered by 1Password, I was able to grasp the concepts and navigate through the complexities with relative ease.
I must express my sincere appreciation to the 1Password team for their exceptional support and willingness to assist me during the development process.
They graciously walked me through the necessary changes for the shell plugin when I submitted a pull request, demonstrating their dedication to fostering a collaborative and helpful developer community.
I am proud to have created a robust Atlas Shell Plugin that seamlessly integrates with 1Password, enhancing password management and streamlining command-line workflows.
#1Password #BuildWith1Password