Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NEXT_PUBLIC_ACCOUNT_ID=
DEPLOYMENT_CONFIG=
SERVER_CONFIG=
4 changes: 2 additions & 2 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export function parseConfig(configString: string): ServerConfig {

export function loadConfig(): ServerConfig {
try {
return parseConfig(getEnvVar('DEPLOYMENT_CONFIG'))
return parseConfig(getEnvVar('SERVER_CONFIG'))
} catch (error: unknown) {
console.warn('Failed to parse DEPLOYMENT_CONFIG, trying individual env vars', String(error))
console.warn('Failed to parse SERVER_CONFIG, trying individual env vars', String(error))
return {
strategy: JSON.parse(getEnvVar('STRATEGY', JSON.stringify(DEFAULT_STRATEGY))),
cronSecret: getEnvVar('CRON_SECRET'),
Expand Down
4 changes: 2 additions & 2 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ describe('loadCOnfig', () => {
bitteKey: 'bitteKey',
nearPk: 'ed25519:9999999999999999999999999999999999999999999',
}
process.env.DEPLOYMENT_CONFIG = JSON.stringify(expected)
process.env.SERVER_CONFIG = JSON.stringify(expected)
expect(loadConfig()).toStrictEqual(expected)
})

it('loads Config directly copied from ATA front end', async () => {
process.env.DEPLOYMENT_CONFIG =
process.env.SERVER_CONFIG =
'{"nearPk":"ed25519:FAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKE","cronSecret":"6969696969696969696969696969696969696969696969696969696969696969","bitteKey":"bitte_AIAIAIAIAIAIAIAIAIAIAI","strategy":"{\"riskParams\":{\"profitTarget\":3,\"stopLoss\":-2,\"maxPositions\":5,\"positionSize\":\"10-20% of USDC\"},\"step1Rules\":\"Quick exits: SELL at +3% profit OR -2% loss. Move fast on both winners and losers. Dont close positions with raw balance below 1000.\",\"step2Rules\":\"Hunt momentum: Price moves >5% with volume spikes, extreme Fear/Greed readings (<20 or >80). Use 1 tool max if needed. Only trade strong directional momentum.\",\"step3Rules\":\"Aggressive sizing: 10-20% per position. Size: Min($15, Max($10, USDC_balance * 0.15)). Allow up to 5 concurrent positions for diversification.\"}"}'
expect(loadConfig()).toBeDefined()
})
Expand Down