@cakemail-org/cakemail-cli 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +12 -0
- package/.env.example +40 -0
- package/.env.test.example +45 -0
- package/CHANGELOG.md +1031 -0
- package/README.md +319 -15
- package/audit-formats.js +128 -0
- package/cakemail.rb +20 -0
- package/dist/cli.js +27 -10
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -6
- package/dist/client.js.map +1 -1
- package/dist/commands/account.js +1 -1
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/attributes.js +1 -1
- package/dist/commands/attributes.js.map +1 -1
- package/dist/commands/campaigns.d.ts.map +1 -1
- package/dist/commands/campaigns.js +103 -8
- package/dist/commands/campaigns.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +63 -4
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/contacts.d.ts.map +1 -1
- package/dist/commands/contacts.js +91 -12
- package/dist/commands/contacts.js.map +1 -1
- package/dist/commands/emails.js +1 -1
- package/dist/commands/emails.js.map +1 -1
- package/dist/commands/interests.d.ts +5 -0
- package/dist/commands/interests.d.ts.map +1 -0
- package/dist/commands/interests.js +172 -0
- package/dist/commands/interests.js.map +1 -0
- package/dist/commands/lists.d.ts.map +1 -1
- package/dist/commands/lists.js +6 -8
- package/dist/commands/lists.js.map +1 -1
- package/dist/commands/logs.d.ts +5 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +237 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/reports.js +1 -1
- package/dist/commands/reports.js.map +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/segments.js.map +1 -1
- package/dist/commands/senders.d.ts.map +1 -1
- package/dist/commands/senders.js +11 -8
- package/dist/commands/senders.js.map +1 -1
- package/dist/commands/suppressed.js +1 -1
- package/dist/commands/suppressed.js.map +1 -1
- package/dist/commands/tags.d.ts +5 -0
- package/dist/commands/tags.d.ts.map +1 -0
- package/dist/commands/tags.js +124 -0
- package/dist/commands/tags.js.map +1 -0
- package/dist/commands/templates.js +1 -1
- package/dist/commands/templates.js.map +1 -1
- package/dist/commands/transactional-templates.d.ts +5 -0
- package/dist/commands/transactional-templates.d.ts.map +1 -0
- package/dist/commands/transactional-templates.js +354 -0
- package/dist/commands/transactional-templates.js.map +1 -0
- package/dist/commands/webhooks.js +1 -1
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/utils/auth.d.ts +8 -1
- package/dist/utils/auth.d.ts.map +1 -1
- package/dist/utils/auth.js +39 -11
- package/dist/utils/auth.js.map +1 -1
- package/dist/utils/config-file.d.ts +7 -0
- package/dist/utils/config-file.d.ts.map +1 -1
- package/dist/utils/config-file.js +15 -0
- package/dist/utils/config-file.js.map +1 -1
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +12 -4
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/errors.js +1 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/list-defaults.d.ts +33 -0
- package/dist/utils/list-defaults.d.ts.map +1 -0
- package/dist/utils/list-defaults.js +52 -0
- package/dist/utils/list-defaults.js.map +1 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +36 -13
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/progress.d.ts.map +1 -1
- package/dist/utils/progress.js +32 -4
- package/dist/utils/progress.js.map +1 -1
- package/dist/utils/spinner.d.ts +17 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +43 -0
- package/dist/utils/spinner.js.map +1 -0
- package/docs/DOCUMENTATION-STANDARD.md +1068 -0
- package/docs/README.md +161 -0
- package/docs/developer/ARCHITECTURE.md +516 -0
- package/docs/developer/AUTH.md +204 -0
- package/docs/developer/CONTRIBUTING.md +227 -0
- package/docs/developer/DOCUMENTATION_SUMMARY.md +346 -0
- package/docs/developer/PROJECT_INDEX.md +365 -0
- package/docs/planning/API_COVERAGE.md +1045 -0
- package/docs/planning/BACKLOG.md +1159 -0
- package/docs/planning/PROFILE_SYSTEM_TASKS.md +287 -0
- package/docs/planning/UX_IMPLEMENTATION_PLAN.md +691 -0
- package/docs/planning/archive/RELEASE_CHECKLIST_v1.3.0.md +332 -0
- package/docs/planning/archive/RELEASE_v1.3.0.md +428 -0
- package/docs/planning/archive/cakemail-cli-ux-improvements.md +438 -0
- package/docs/planning/cakemail-profile-system-plan.md +1121 -0
- package/docs/testing/AI_USER_SIMULATION_DESIGN.md +1342 -0
- package/docs/testing/KENOGAMI_BIDIRECTIONAL_FLOW.md +1517 -0
- package/docs/testing/KENOGAMI_TRUTH_RECONCILIATION_SYSTEM.md +1369 -0
- package/docs/user-manual/.obsidian/app.json +1 -0
- package/docs/user-manual/.obsidian/appearance.json +1 -0
- package/docs/user-manual/.obsidian/core-plugins.json +33 -0
- package/docs/user-manual/.obsidian/workspace.json +167 -0
- package/docs/user-manual/01-getting-started/01-installation.md +214 -0
- package/docs/user-manual/01-getting-started/02-quick-start.md +432 -0
- package/docs/user-manual/01-getting-started/03-authentication.md +448 -0
- package/docs/user-manual/01-getting-started/04-configuration.md +430 -0
- package/docs/user-manual/01-getting-started/05-output-formats.md +447 -0
- package/docs/user-manual/02-core-concepts/01-accounts.md +514 -0
- package/docs/user-manual/02-core-concepts/02-profile-system.md +771 -0
- package/docs/user-manual/02-core-concepts/03-smart-defaults.md +485 -0
- package/docs/user-manual/02-core-concepts/04-authentication-methods.md +435 -0
- package/docs/user-manual/02-core-concepts/05-pagination-filtering.md +600 -0
- package/docs/user-manual/02-core-concepts/06-error-handling.md +718 -0
- package/docs/user-manual/02-core-concepts/07-api-coverage.md +483 -0
- package/docs/user-manual/03-email-operations/01-senders.md +490 -0
- package/docs/user-manual/03-email-operations/02-templates.md +444 -0
- package/docs/user-manual/03-email-operations/03-transactional-emails.md +706 -0
- package/docs/user-manual/03-email-operations/04-email-tracking.md +407 -0
- package/docs/user-manual/04-campaign-management/01-campaigns-basics.md +394 -0
- package/docs/user-manual/04-campaign-management/02-campaign-scheduling.md +630 -0
- package/docs/user-manual/04-campaign-management/03-campaign-testing.md +997 -0
- package/docs/user-manual/04-campaign-management/04-campaign-lifecycle.md +709 -0
- package/docs/user-manual/04-campaign-management/05-campaign-links.md +934 -0
- package/docs/user-manual/05-contact-management/01-lists.md +836 -0
- package/docs/user-manual/05-contact-management/02-contacts.md +1035 -0
- package/docs/user-manual/05-contact-management/03-custom-attributes.md +788 -0
- package/docs/user-manual/05-contact-management/04-segments.md +1028 -0
- package/docs/user-manual/05-contact-management/05-contact-import-export.md +1031 -0
- package/docs/user-manual/06-analytics-reporting/01-campaign-analytics.md +867 -0
- package/docs/user-manual/06-analytics-reporting/02-account-reports.md +227 -0
- package/docs/user-manual/07-integrations/01-webhooks-integration.md +259 -0
- package/docs/user-manual/07-integrations/02-automation.md +326 -0
- package/docs/user-manual/08-advanced-usage/01-scripting-patterns.md +672 -0
- package/docs/user-manual/08-advanced-usage/02-bulk-operations.md +932 -0
- package/docs/user-manual/08-advanced-usage/03-ci-cd-integration.md +892 -0
- package/docs/user-manual/08-advanced-usage/04-performance-optimization.md +766 -0
- package/docs/user-manual/09-command-reference/01-config.md +776 -0
- package/docs/user-manual/09-command-reference/02-account.md +652 -0
- package/docs/user-manual/09-command-reference/03-lists.md +958 -0
- package/docs/user-manual/09-command-reference/04-contacts.md +1408 -0
- package/docs/user-manual/09-command-reference/05-attributes.md +617 -0
- package/docs/user-manual/09-command-reference/06-segments.md +894 -0
- package/docs/user-manual/09-command-reference/07-senders.md +803 -0
- package/docs/user-manual/09-command-reference/08-templates.md +818 -0
- package/docs/user-manual/09-command-reference/09-campaigns.md +1250 -0
- package/docs/user-manual/09-command-reference/10-emails.md +807 -0
- package/docs/user-manual/09-command-reference/11-reports.md +1135 -0
- package/docs/user-manual/09-command-reference/12-webhooks.md +773 -0
- package/docs/user-manual/09-command-reference/13-suppressed.md +797 -0
- package/docs/user-manual/09-command-reference/14-interests.md +630 -0
- package/docs/user-manual/09-command-reference/15-tags.md +584 -0
- package/docs/user-manual/09-command-reference/16-logs.md +656 -0
- package/docs/user-manual/09-command-reference/17-transactional-templates.md +850 -0
- package/docs/user-manual/10-troubleshooting/01-common-errors.md +457 -0
- package/docs/user-manual/10-troubleshooting/02-authentication-issues.md +558 -0
- package/docs/user-manual/10-troubleshooting/03-connection-problems.md +634 -0
- package/docs/user-manual/10-troubleshooting/04-debugging.md +725 -0
- package/docs/user-manual/11-appendix/04-faq.md +484 -0
- package/docs/user-manual/11-appendix/05-glossary.md +250 -0
- package/docs/user-manual/README.md +0 -0
- package/package.json +13 -47
- package/src/cli.ts +125 -0
- package/src/client.ts +16 -0
- package/src/commands/account.ts +267 -0
- package/src/commands/accounts.ts +78 -0
- package/src/commands/actions.ts +249 -0
- package/src/commands/attributes.ts +139 -0
- package/src/commands/campaign-blueprints.ts +106 -0
- package/src/commands/campaigns.ts +469 -0
- package/src/commands/config.ts +77 -0
- package/src/commands/contacts.ts +612 -0
- package/src/commands/custom-attributes.ts +127 -0
- package/src/commands/dkims.ts +117 -0
- package/src/commands/domains.ts +82 -0
- package/src/commands/email-apis.ts +569 -0
- package/src/commands/emails.ts +197 -0
- package/src/commands/forms.ts +283 -0
- package/src/commands/interests.ts +155 -0
- package/src/commands/links.ts +38 -0
- package/src/commands/lists.ts +406 -0
- package/src/commands/logos.ts +71 -0
- package/src/commands/logs.ts +386 -0
- package/src/commands/reports.ts +306 -0
- package/src/commands/segments.ts +158 -0
- package/src/commands/senders.ts +204 -0
- package/src/commands/sub-accounts.ts +271 -0
- package/src/commands/suppressed-emails.ts +234 -0
- package/src/commands/suppressed.ts +198 -0
- package/src/commands/system-emails.ts +85 -0
- package/src/commands/tags.ts +146 -0
- package/src/commands/tasks.ts +116 -0
- package/src/commands/templates.ts +189 -0
- package/src/commands/tokens.ts +83 -0
- package/src/commands/transactional-emails.ts +374 -0
- package/src/commands/transactional-templates.ts +385 -0
- package/src/commands/users.ts +506 -0
- package/src/commands/webhooks.ts +172 -0
- package/src/commands/workflow-blueprints.ts +123 -0
- package/src/commands/workflows.ts +265 -0
- package/src/types/profile.ts +93 -0
- package/src/utils/auth.ts +272 -0
- package/src/utils/config-file.ts +96 -0
- package/src/utils/config.ts +134 -0
- package/src/utils/confirm.ts +32 -0
- package/src/utils/defaults.ts +99 -0
- package/src/utils/errors.ts +116 -0
- package/src/utils/interactive.ts +91 -0
- package/src/utils/list-defaults.ts +74 -0
- package/src/utils/output.ts +190 -0
- package/src/utils/progress.ts +320 -0
- package/src/utils/spinner.ts +22 -0
- package/tests/IMPLEMENTATION_STATUS.md +258 -0
- package/tests/PTY_SETUP.md +118 -0
- package/tests/PTY_TESTING_GUIDE.md +507 -0
- package/tests/README.md +244 -0
- package/tests/fixtures/api-responses/campaigns.json +34 -0
- package/tests/fixtures/test-config.json +13 -0
- package/tests/helpers/cli-runner.ts +128 -0
- package/tests/helpers/mock-server.ts +301 -0
- package/tests/helpers/pty-runner.ts +181 -0
- package/tests/integration/campaigns-real-api.test.ts +196 -0
- package/tests/integration/setup-integration.ts +50 -0
- package/tests/pty/campaigns.test.ts +241 -0
- package/tests/setup.ts +34 -0
- package/tsconfig.json +15 -0
- package/vitest.config.ts +28 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Configure the Cakemail CLI to match your preferences and workflow.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The CLI can be configured using:
|
|
8
|
+
- Environment variables
|
|
9
|
+
- `.env` files (project or global)
|
|
10
|
+
- Command-line flags (per-command overrides)
|
|
11
|
+
|
|
12
|
+
## Configuration Options
|
|
13
|
+
|
|
14
|
+
### Authentication
|
|
15
|
+
|
|
16
|
+
See [Authentication](/en/cli/getting-started/authentication/) for detailed authentication configuration.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Access token (recommended)
|
|
20
|
+
CAKEMAIL_ACCESS_TOKEN=your_access_token
|
|
21
|
+
|
|
22
|
+
# OR email/password
|
|
23
|
+
CAKEMAIL_EMAIL=your@email.com
|
|
24
|
+
CAKEMAIL_PASSWORD=your_password
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Output Format
|
|
28
|
+
|
|
29
|
+
Control how command results are displayed.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Default output format: json, table, or compact
|
|
33
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
See [Output Formats](/en/cli/getting-started/output-formats/) for details on each format.
|
|
37
|
+
|
|
38
|
+
### API Base URL
|
|
39
|
+
|
|
40
|
+
Override the default API endpoint (advanced use only).
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Default: https://api.cakemail.dev
|
|
44
|
+
CAKEMAIL_API_BASE=https://api.cakemail.dev
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Note**: Only change this if you're using a different API environment or a self-hosted instance.
|
|
48
|
+
|
|
49
|
+
### Default Account
|
|
50
|
+
|
|
51
|
+
Set a default account ID for multi-account setups.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Use specific account by default
|
|
55
|
+
CAKEMAIL_ACCOUNT_ID=12345
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Profile System (v1.5.0+)
|
|
59
|
+
|
|
60
|
+
The CLI adapts its behavior to your workflow through profiles. See [Profile System](/en/cli/core-concepts/profile-system/) for details.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Set your preferred profile (developer | marketer | balanced)
|
|
64
|
+
# This is managed through config commands, not environment variables
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Available Profiles:**
|
|
68
|
+
- **Developer**: Fast, non-interactive, JSON output, no confirmations
|
|
69
|
+
- **Marketer**: Interactive, guided, rich colors, safety confirmations
|
|
70
|
+
- **Balanced**: Auto-detect context, moderate colors (default)
|
|
71
|
+
|
|
72
|
+
**Profile Management:**
|
|
73
|
+
```bash
|
|
74
|
+
# View current profile
|
|
75
|
+
cakemail config profile
|
|
76
|
+
|
|
77
|
+
# Switch profile
|
|
78
|
+
cakemail config profile-set developer
|
|
79
|
+
cakemail config profile-set marketer
|
|
80
|
+
cakemail config profile-set balanced
|
|
81
|
+
|
|
82
|
+
# Preview profile before switching
|
|
83
|
+
cakemail config preview developer
|
|
84
|
+
|
|
85
|
+
# Customize individual settings
|
|
86
|
+
cakemail config set output_format json
|
|
87
|
+
|
|
88
|
+
# Reset to profile defaults
|
|
89
|
+
cakemail config reset
|
|
90
|
+
|
|
91
|
+
# Show complete configuration
|
|
92
|
+
cakemail config show
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Profile Storage:**
|
|
96
|
+
Profile settings are stored in `~/.cakemail/config.json` (not in `.env` file).
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Configuration Files
|
|
101
|
+
|
|
102
|
+
### Project Configuration (.env)
|
|
103
|
+
|
|
104
|
+
Create a `.env` file in your project directory for project-specific settings:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# .env
|
|
108
|
+
CAKEMAIL_ACCESS_TOKEN=your_access_token
|
|
109
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
110
|
+
CAKEMAIL_ACCOUNT_ID=12345
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Best for:**
|
|
114
|
+
- Project-specific credentials
|
|
115
|
+
- Team projects with shared configuration
|
|
116
|
+
- Different settings per project
|
|
117
|
+
|
|
118
|
+
### Global Configuration (~/.cakemail/.env)
|
|
119
|
+
|
|
120
|
+
Create a global configuration file for user-wide settings:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
mkdir -p ~/.cakemail
|
|
124
|
+
cat > ~/.cakemail/.env <<EOF
|
|
125
|
+
CAKEMAIL_ACCESS_TOKEN=your_access_token
|
|
126
|
+
CAKEMAIL_OUTPUT_FORMAT=table
|
|
127
|
+
EOF
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Best for:**
|
|
131
|
+
- Personal credentials
|
|
132
|
+
- Consistent settings across all projects
|
|
133
|
+
- Quick CLI usage without per-project setup
|
|
134
|
+
|
|
135
|
+
### Configuration Priority
|
|
136
|
+
|
|
137
|
+
When multiple configuration sources exist, the CLI uses this priority:
|
|
138
|
+
|
|
139
|
+
1. **Command-line flags** (highest)
|
|
140
|
+
```bash
|
|
141
|
+
cakemail -f json campaigns list
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
2. **Environment variables**
|
|
145
|
+
```bash
|
|
146
|
+
export CAKEMAIL_OUTPUT_FORMAT=compact
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
3. **Project .env file** (`./env`)
|
|
150
|
+
|
|
151
|
+
4. **Global .env file** (`~/.cakemail/.env`)
|
|
152
|
+
|
|
153
|
+
5. **Default values** (lowest)
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Example Configurations
|
|
158
|
+
|
|
159
|
+
### Development Setup
|
|
160
|
+
|
|
161
|
+
For local development with interactive output:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# .env
|
|
165
|
+
CAKEMAIL_EMAIL=developer@example.com
|
|
166
|
+
CAKEMAIL_PASSWORD=dev_password
|
|
167
|
+
CAKEMAIL_OUTPUT_FORMAT=table
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Production/CI Setup
|
|
171
|
+
|
|
172
|
+
For automation with machine-readable output:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# .env
|
|
176
|
+
CAKEMAIL_ACCESS_TOKEN=prod_token_here
|
|
177
|
+
CAKEMAIL_OUTPUT_FORMAT=json
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Multi-Account Setup
|
|
181
|
+
|
|
182
|
+
For managing multiple accounts:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# ~/.cakemail/.env (global)
|
|
186
|
+
CAKEMAIL_ACCESS_TOKEN=your_token
|
|
187
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
188
|
+
|
|
189
|
+
# Override per project
|
|
190
|
+
# project-a/.env
|
|
191
|
+
CAKEMAIL_ACCOUNT_ID=12345
|
|
192
|
+
|
|
193
|
+
# project-b/.env
|
|
194
|
+
CAKEMAIL_ACCOUNT_ID=67890
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Command-Line Flags
|
|
200
|
+
|
|
201
|
+
Override configuration for individual commands.
|
|
202
|
+
|
|
203
|
+
### Global Flags
|
|
204
|
+
|
|
205
|
+
These flags work with all commands:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Output format
|
|
209
|
+
cakemail -f json campaigns list
|
|
210
|
+
cakemail -f table campaigns list
|
|
211
|
+
cakemail -f compact campaigns list
|
|
212
|
+
|
|
213
|
+
# Profile override (v1.5.0+)
|
|
214
|
+
cakemail --profile developer campaigns list
|
|
215
|
+
cakemail --profile marketer campaigns create
|
|
216
|
+
|
|
217
|
+
# Batch mode - disable all interactive features (v1.5.0+)
|
|
218
|
+
cakemail --batch campaigns create --name "Newsletter" --list-id 123 --sender-id 456
|
|
219
|
+
|
|
220
|
+
# Authentication override
|
|
221
|
+
cakemail --access-token abc123 campaigns list
|
|
222
|
+
cakemail --email user@example.com --password pass123 campaigns list
|
|
223
|
+
|
|
224
|
+
# Account override
|
|
225
|
+
cakemail --account 12345 campaigns list
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Combining Flags
|
|
229
|
+
|
|
230
|
+
You can combine multiple flags:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
cakemail -f table --account 12345 campaigns list
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Environment Variables Reference
|
|
239
|
+
|
|
240
|
+
Complete list of environment variables:
|
|
241
|
+
|
|
242
|
+
| Variable | Description | Default | Example |
|
|
243
|
+
|----------|-------------|---------|---------|
|
|
244
|
+
| `CAKEMAIL_ACCESS_TOKEN` | API access token | None | `abc123xyz` |
|
|
245
|
+
| `CAKEMAIL_EMAIL` | Account email | None | `user@example.com` |
|
|
246
|
+
| `CAKEMAIL_PASSWORD` | Account password | None | `mypassword` |
|
|
247
|
+
| `CAKEMAIL_OUTPUT_FORMAT` | Default output format | `json` | `compact`, `table`, `json` |
|
|
248
|
+
| `CAKEMAIL_API_BASE` | API base URL | `https://api.cakemail.dev` | `https://api.example.com` |
|
|
249
|
+
| `CAKEMAIL_ACCOUNT_ID` | Default account ID | None | `12345` |
|
|
250
|
+
| `CAKEMAIL_BATCH_MODE` | Force batch mode (v1.5.0+) | `false` | `true` |
|
|
251
|
+
|
|
252
|
+
**Note**: Profile settings are managed via config commands, not environment variables. See [Profile System](/en/cli/core-concepts/profile-system/).
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Setting Environment Variables
|
|
257
|
+
|
|
258
|
+
### Temporary (Current Session)
|
|
259
|
+
|
|
260
|
+
Set for the current terminal session only:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
export CAKEMAIL_OUTPUT_FORMAT=compact
|
|
264
|
+
cakemail campaigns list
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Permanent (Shell Profile)
|
|
268
|
+
|
|
269
|
+
Add to your shell profile for persistence across sessions.
|
|
270
|
+
|
|
271
|
+
**For Zsh (macOS default):**
|
|
272
|
+
```bash
|
|
273
|
+
echo 'export CAKEMAIL_OUTPUT_FORMAT=compact' >> ~/.zshrc
|
|
274
|
+
source ~/.zshrc
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**For Bash:**
|
|
278
|
+
```bash
|
|
279
|
+
echo 'export CAKEMAIL_OUTPUT_FORMAT=compact' >> ~/.bashrc
|
|
280
|
+
source ~/.bashrc
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Project-Specific (.env file)
|
|
284
|
+
|
|
285
|
+
Recommended approach for most users:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Create .env file
|
|
289
|
+
cat > .env <<EOF
|
|
290
|
+
CAKEMAIL_ACCESS_TOKEN=your_token
|
|
291
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
292
|
+
EOF
|
|
293
|
+
|
|
294
|
+
# Add .env to .gitignore
|
|
295
|
+
echo '.env' >> .gitignore
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Configuration Best Practices
|
|
301
|
+
|
|
302
|
+
### 1. Use .env Files
|
|
303
|
+
|
|
304
|
+
**Do:**
|
|
305
|
+
```bash
|
|
306
|
+
# .env
|
|
307
|
+
CAKEMAIL_ACCESS_TOKEN=your_token
|
|
308
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Don't:**
|
|
312
|
+
```bash
|
|
313
|
+
# Hardcode credentials in scripts
|
|
314
|
+
cakemail --access-token abc123 campaigns list
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### 2. Keep .env Out of Version Control
|
|
318
|
+
|
|
319
|
+
Always add `.env` to `.gitignore`:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
echo '.env' >> .gitignore
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Provide a template instead:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
# .env.example
|
|
329
|
+
CAKEMAIL_ACCESS_TOKEN=your_access_token_here
|
|
330
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### 3. Use Appropriate Output Formats
|
|
334
|
+
|
|
335
|
+
Choose the right format for your use case:
|
|
336
|
+
|
|
337
|
+
- **Interactive use**: `table` or `compact`
|
|
338
|
+
- **Scripts/automation**: `json`
|
|
339
|
+
- **Quick checks**: `compact`
|
|
340
|
+
|
|
341
|
+
### 4. Separate Development and Production
|
|
342
|
+
|
|
343
|
+
Use different configuration files:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# .env.development
|
|
347
|
+
CAKEMAIL_EMAIL=dev@example.com
|
|
348
|
+
CAKEMAIL_OUTPUT_FORMAT=table
|
|
349
|
+
|
|
350
|
+
# .env.production
|
|
351
|
+
CAKEMAIL_ACCESS_TOKEN=prod_token
|
|
352
|
+
CAKEMAIL_OUTPUT_FORMAT=json
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Load the appropriate file:
|
|
356
|
+
```bash
|
|
357
|
+
# Development
|
|
358
|
+
cp .env.development .env
|
|
359
|
+
|
|
360
|
+
# Production
|
|
361
|
+
cp .env.production .env
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### 5. Use Global Config for Personal Use
|
|
365
|
+
|
|
366
|
+
For personal CLI usage, global configuration is convenient:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# ~/.cakemail/.env
|
|
370
|
+
CAKEMAIL_ACCESS_TOKEN=your_personal_token
|
|
371
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
Then run commands anywhere without per-project setup.
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Verifying Configuration
|
|
379
|
+
|
|
380
|
+
### Check Current Settings
|
|
381
|
+
|
|
382
|
+
View environment variables:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Show all CAKEMAIL_* variables
|
|
386
|
+
env | grep CAKEMAIL
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Test Configuration
|
|
390
|
+
|
|
391
|
+
Run a simple command to verify:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# This should use your configured credentials and format
|
|
395
|
+
cakemail campaigns list --limit 1
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Debug Configuration Issues
|
|
399
|
+
|
|
400
|
+
If configuration isn't working:
|
|
401
|
+
|
|
402
|
+
1. **Check variable names** (must be exact)
|
|
403
|
+
```bash
|
|
404
|
+
# Correct
|
|
405
|
+
CAKEMAIL_OUTPUT_FORMAT=compact
|
|
406
|
+
|
|
407
|
+
# Wrong (won't work)
|
|
408
|
+
CAKEMAIL_FORMAT=compact
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
2. **Verify .env file location**
|
|
412
|
+
```bash
|
|
413
|
+
# Should be in project root or ~/.cakemail/
|
|
414
|
+
ls -la .env
|
|
415
|
+
ls -la ~/.cakemail/.env
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
3. **Check file permissions**
|
|
419
|
+
```bash
|
|
420
|
+
chmod 600 .env
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
4. **Test with explicit flags**
|
|
424
|
+
```bash
|
|
425
|
+
# Override config to test
|
|
426
|
+
cakemail -f json --access-token test_token campaigns list
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|