Configuration¶
Authentication¶
The Aha! API requires two pieces of information:
| Parameter | Description | Example |
|---|---|---|
| Domain | Your Aha! subdomain | mycompany (from mycompany.aha.io) |
| API Key | Your personal API key | abc123... |
CLI Configuration¶
Environment Variables (Recommended)¶
Set environment variables in your shell profile:
Then use the CLI without flags:
Command-Line Flags¶
Pass credentials directly (useful for scripts or one-off commands):
Or use short flags:
Priority Order¶
The CLI uses credentials in this order:
- Command-line flags (
--domain,--api-key) - Environment variables (
AHA_DOMAIN,AHA_API_KEY)
SDK Configuration¶
Using Environment Variables¶
import (
"os"
"github.com/grokify/go-aha/v3/oag7/aha"
"github.com/grokify/go-aha/v3/oag7/client"
)
func main() {
domain := os.Getenv("AHA_DOMAIN")
apiKey := os.Getenv("AHA_API_KEY")
cfg, err := client.NewConfiguration(domain, apiKey)
if err != nil {
panic(err)
}
apiClient := aha.NewAPIClient(cfg)
// Use apiClient...
}
Direct Configuration¶
cfg, err := client.NewConfiguration("mycompany", "your-api-key")
if err != nil {
panic(err)
}
apiClient := aha.NewAPIClient(cfg)
Security Best Practices¶
Environment Variables
Always use environment variables in production. Never hardcode API keys.
Git Ignore
Add .env and similar files to .gitignore to prevent accidental commits.
Example .env file (do not commit):
Load with a tool like direnv or source manually: