Skip to content

Conversation

@BrianJKoopman
Copy link
Member

Description

This PR adds two methods for passing credentials to the InfluxDBClient within the InfluxDB publisher agent.

Credentials can be passed either directly through INFLUXDB_USERNAME and INFLUXDB_PASSWORD, or by reading files specified with INFLUXDB_USERNAME_FILE and INFLUXDB_PASSWORD_FILE.

Motivation and Context

Resolves #431.

How Has This Been Tested?

There's a new unit test for testing loading credentials via the various methods. I also tested this locally with an instance of InfluxDB 1.8.10 where I created a username/password, then enabled HTTP auth via setting INFLUXDB_HTTP_AUTH_ENABLED=true in the compose file, like this:

  influxdb:
    image: "influxdb:1.8"
    container_name: "influxdb"
    volumes:
      - influxdb-storage:/var/lib/influxdb
    environment:
      - INFLUXDB_HTTP_AUTH_ENABLED=true

Then I tested passing no credentials (defaults to 'root'/'root'), which fails. I tested passing credentials from file via Docker Secrets. And then tested passing credentials via the environment variables directly, also testing that this takes precedence over reading from file.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@BrianJKoopman BrianJKoopman added the enhancement New feature or request label Jul 28, 2025
@BrianJKoopman BrianJKoopman merged commit 4f04551 into main Jul 30, 2025
5 checks passed
@BrianJKoopman BrianJKoopman deleted the koopman/influxdb-publisher-auth branch July 30, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to pass credentials to InfluxDB client

2 participants