The lessc compiler on NodeJS, mentions the following options (from https://lesscss.org/usage/#less-options):
Global Variables
lessc --global-var="color1=red"
{ globalVars: { color1: 'red' } }
This option defines a variable that can be referenced by the file.
Effectively the declaration is put at the top of your base Less file, meaning it can be used but it also can be overridden if this variable is defined in the file.
Modify Variables
lessc --modify-var="color1=red"
{ modifyVars: { color1: 'red' } }
As opposed to the global variable option, this puts the declaration at the end of your base file, meaning it will override anything defined in your Less file.
Depending on how you call the compiler, you can insert environment variables here.