[Solved] How to set up a variable in .env file and using it in a .conf file

Geralt Asks: How to set up a variable in .env file and using it in a .conf file
I have a .conf file that has a label and variable that I’m trying to move to a .env file. How can I accomplish this?

This is what I have in my .conf file

Code:
[[inputs.snmp]] #Label
    agents = ["1.1.1.1:111","2.2.2.2:111","2.3.3.3:111"] #Variable
    version = 2 #Variable

I’m trying to have something like this in the .env file

Code:
VAR_FOR_CONF_FILE='[[inputs.snmp]]n    agents= ["1.1.1.1:111","2.2.2.2:111","2.3.3.3:111"]n    version=2'

I was hoping I could use $VAR_FOR_CONF_FILE in my .conf file instead of [[inputs.snmp]]agents = ["1.1.1.1:111","2.2.2.2:111","2.3.3.3:111"]

but I keep getting this error Error parsing data: line 7: invalid TOML syntax for $VAR_FOR_CONF_FILE (Im not sure if I’m getting this error because I have the syntax wrong in my .env file or I’m declaring $VAR_FOR_CONF_FILE incorrectly in my .conf file)

Am I doing it incorrectly (or is it even possible to do what I’m trying to accomplish)?

(Note: I’m trying to accomplish this so I can simply use $VAR_FOR_CONF_FILE instead of hard coding things in the .conf file)

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.