peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
140 stars 37 forks source link

Error creating the config. The variables ARTI_USERNAME, ARTI_ACCESS_TOKEN are not being read #143

Closed caprivm closed 1 month ago

caprivm commented 1 month ago

Hello,

I'm trying to do a local test with the artifactory_exporter container. Making some modifications to the Dockerfile, I am running the binary file manually so I can go deep in the error. I'm receiving this message from logs:

time=2024-06-04T20:32:03.609Z level=ERROR msg="Error creating the config." err="`ARTI_USERNAME` and `ARTI_PASSWORD` or `ARTI_ACCESS_TOKEN` environment variable hast to be set"

That's weird, because in the container I can see the variables in the environment. I'm using printenv | grep ARTI:

ARTI_ACCESS_TOKEN=***myartiaccesstoken***
ARTI_SCRAPE_URI=http://localhost:8081/artifactory
ARTI_USERNAME=***myartiusername***

Do you know if it could be due to some broken dependency?, I have tried also with the docker hub image in the version v1.14.0 and it's not working. I'm also tried with a local Kubernetes deployment using the repository of helm-charts and it's not working.

Thanks in advance for any help, Capri.

joshuagoraum commented 1 month ago

Removing the 'ARTI_USERNAME' variable from my kubernetes cluster secret and restarting the pod worked for me. Maybe if you provide 'ARTI_USERNAME' without a password or if you don't provide any auth it will throw the error you mentioned above?

caprivm commented 1 month ago

Yes, it works!. I unset my ARTI_USERNAME variable and left only the one related to ARTI_ACCESS_TOKEN. It is now working correctly. It seems like the Token already has information about the user is trying to login.

Thank you @joshuagoraum .