feat: add OpenAI OAuth, strict model overrides, and Gmail pull mode
This commit is contained in:
@@ -53,6 +53,45 @@ models:
|
||||
expect(result.config!.telegram?.bot_token).toBe('test-token');
|
||||
});
|
||||
|
||||
it('loads env vars from FLYNN_ENV_FILE before parsing config', () => {
|
||||
const prevEnvFile = process.env.FLYNN_ENV_FILE;
|
||||
const prevToken = process.env.TEST_BOT_TOKEN;
|
||||
delete process.env.TEST_BOT_TOKEN;
|
||||
|
||||
mkdirSync(testDir, { recursive: true });
|
||||
const envPath = join(testDir, 'cloud.env');
|
||||
const configPath = join(testDir, 'config.yaml');
|
||||
|
||||
writeFileSync(envPath, 'TEST_BOT_TOKEN=test-token\n');
|
||||
process.env.FLYNN_ENV_FILE = envPath;
|
||||
|
||||
writeFileSync(configPath, `
|
||||
telegram:
|
||||
bot_token: \${TEST_BOT_TOKEN}
|
||||
allowed_chat_ids: [123]
|
||||
models:
|
||||
default:
|
||||
provider: anthropic
|
||||
model: claude-sonnet
|
||||
`);
|
||||
|
||||
const result = loadConfigSafe(configPath);
|
||||
expect(result.config).toBeDefined();
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.config!.telegram?.bot_token).toBe('test-token');
|
||||
|
||||
if (prevEnvFile !== undefined) {
|
||||
process.env.FLYNN_ENV_FILE = prevEnvFile;
|
||||
} else {
|
||||
delete process.env.FLYNN_ENV_FILE;
|
||||
}
|
||||
if (prevToken !== undefined) {
|
||||
process.env.TEST_BOT_TOKEN = prevToken;
|
||||
} else {
|
||||
delete process.env.TEST_BOT_TOKEN;
|
||||
}
|
||||
});
|
||||
|
||||
it('returns error when file not found', () => {
|
||||
const result = loadConfigSafe('/nonexistent/config.yaml');
|
||||
expect(result.config).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user