[Refactor] Store values on .env file
Opened this issue · 1 comments
jmoreira-valory commented
The run_service.sh
script stores a number of variables as text files (e.g., rpc.txt). Instead, store these values within the .env files, unless they are not explicitly required in a file (e.g., the file agent_pkey.txt is required in a separate file, even though it is just the value of a private key).
The following approach should be used:
- Implement a method
set_env_var VAR VALUE
which:- Creates the .env file if it does not exist.
- Updates VAR=OLD_VALUE to VAR=VALUE if the entry for VAR exists in .env file.
- Appends VAR=VALUE to the env file if VAR does not exist in the .env file.
- exports VAR=VALUE to the environment to be used in the rest of the script.
The file .env should be sourced at the appropriate point at the start of the script.
jmoreira-valory commented
Partialy completed on #111 : The method is completed there, and used for USE_STAKING and AGENT_ID; the rest of the eligible variables are not addressed.