Skip to content

Commit 17dbc1a

Browse files
guo-yuclaude
andcommitted
fix: auto-set storage_provider to remote on claim and api_key/worker_url config
CLI defaulted to sqlite storage after claim, causing inbox to read from an empty local database instead of the remote API. Now explicitly sets storage_provider to "remote" in all config paths: claim, config set api_key (for @mails.dev), and config set worker_url. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 809ac72 commit 17dbc1a

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mails",
3-
"version": "1.5.3",
3+
"version": "1.5.4",
44
"description": "Email infrastructure for AI agents",
55
"type": "module",
66
"main": "dist/index.js",

src/cli/commands/claim.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export async function claimCommand(args: string[]) {
8383
setConfigValue('mailbox', pollData.mailbox!)
8484
setConfigValue('api_key', pollData.api_key!)
8585
setConfigValue('default_from', pollData.mailbox!)
86+
setConfigValue('storage_provider', 'remote')
8687

8788
console.log(` Claimed: ${pollData.mailbox}`)
8889
console.log(` API Key: ${pollData.api_key}`)

src/cli/commands/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ export async function configCommand(args: string[]) {
3535
console.log(`Set default_from = ${mailbox}`)
3636
}
3737
}
38+
39+
// When worker_url is set, switch to remote storage
40+
if (key === 'worker_url') {
41+
setConfigValue('storage_provider', 'remote')
42+
}
3843
break
3944
}
4045

src/core/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export async function resolveApiKey(apiKey: string): Promise<string | null> {
6565
if (data.mailbox) {
6666
setConfigValue('mailbox', data.mailbox)
6767
setConfigValue('default_from', data.mailbox)
68+
if (data.mailbox.endsWith('@mails.dev')) {
69+
setConfigValue('storage_provider', 'remote')
70+
}
6871
return data.mailbox
6972
}
7073
} catch {}

0 commit comments

Comments
 (0)