1

I'm trying to use the remote config feature of InfluxDB and Telegraf. If I set the enviroment variable with

$env:INFLUX_TOKEN = "thisIsMyToken"

and then test things with

.\telegraf.exe --config "https://influxdbserver:port/myremoteconfig" --test

it seems to be working. When I try to install the service with

.\telegraf.exe --service install --config "https://influxdbserver:port/myremoteconfig"

the connection does not work and according to the windows event manager it can't load the config file due to "401 Unauthorized". Which is the same error I get when not setting the token before using the --test command. I assume the problem is with the service not seeing the enviroment variable. But how can I get the variable into the service?

doofesohr
  • 177
  • 1
  • 11

1 Answers1

0

You can use setx, though that'll set an env var that all users on your system can view

setx /M INFLUX_TOKEN "ThisisMyToken"

credits to kittenless_tootler

Ties
  • 5,726
  • 3
  • 28
  • 37