Skip to content

Commit 084bf94

Browse files
authored
Server Config (#13)
1 parent 1b65729 commit 084bf94

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
NEXT_PUBLIC_ACCOUNT_ID=
2-
DEPLOYMENT_CONFIG=
2+
SERVER_CONFIG=

lib/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export function parseConfig(configString: string): ServerConfig {
5454

5555
export function loadConfig(): ServerConfig {
5656
try {
57-
return parseConfig(getEnvVar('DEPLOYMENT_CONFIG'))
57+
return parseConfig(getEnvVar('SERVER_CONFIG'))
5858
} catch (error: unknown) {
59-
console.warn('Failed to parse DEPLOYMENT_CONFIG, trying individual env vars', String(error))
59+
console.warn('Failed to parse SERVER_CONFIG, trying individual env vars', String(error))
6060
return {
6161
strategy: JSON.parse(getEnvVar('STRATEGY', JSON.stringify(DEFAULT_STRATEGY))),
6262
cronSecret: getEnvVar('CRON_SECRET'),

tests/config.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ describe('loadCOnfig', () => {
2121
bitteKey: 'bitteKey',
2222
nearPk: 'ed25519:9999999999999999999999999999999999999999999',
2323
}
24-
process.env.DEPLOYMENT_CONFIG = JSON.stringify(expected)
24+
process.env.SERVER_CONFIG = JSON.stringify(expected)
2525
expect(loadConfig()).toStrictEqual(expected)
2626
})
2727

2828
it('loads Config directly copied from ATA front end', async () => {
29-
process.env.DEPLOYMENT_CONFIG =
29+
process.env.SERVER_CONFIG =
3030
'{"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.\"}"}'
3131
expect(loadConfig()).toBeDefined()
3232
})

0 commit comments

Comments
 (0)