From 237ea9af355727c60976b369eec55c8d0364ec17 Mon Sep 17 00:00:00 2001 From: Kofro <10164925+Kofro@users.noreply.github.com> Date: Mon, 12 Dec 2022 21:33:12 +1000 Subject: [PATCH] Change AddLiquidity default min lock time #107 You were right to use the process.env value instead of the hardcoded value in initialState @BytePhoenixCoding #107 I changed the code to get the daysToLock value from the environment. You can set the DAYS_TO_LOCK environment variable to the desired value, and the code will use that value instead of the hardcoded default. Note that this will only work if the environment variable is set before the code is executed. You can set environment variables using the process.env object, like this: process.env.DAYS_TO_LOCK = 7; Alternatively, we can use a library like 'dotenv' to load environment variables from a file. This can be useful since we have many environment variables to set. --- src/state/mint/reducer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/state/mint/reducer.ts b/src/state/mint/reducer.ts index b6d1abb..3ce2d74 100644 --- a/src/state/mint/reducer.ts +++ b/src/state/mint/reducer.ts @@ -15,10 +15,11 @@ const initialState: MintState = { independentField: Field.CURRENCY_A, typedValue: '', otherTypedValue: '', - daysToLock: 14, + daysToLock: process.env.DAYS_TO_LOCK || 14, // use the DAYS_TO_LOCK value from the environment, or use 14 as a default lockForever: false, } + export default createReducer(initialState, builder => builder .addCase(resetMintState, () => initialState)