Skip to content

[Bug]: Env var handling #465

@eaglesemanation

Description

@eaglesemanation

Binner version

v2.6.18

Operating System

Docker

Describe the bug and the steps to reproduce it

  1. According to both https://hub.docker.com/r/binnerofficial/binner and https://github.com/replaysMike/Binner/wiki/Docker I'm supposed to set BINNER_PROVIDER to change db.
    But according to

    public const string StorageProviderName = "BINNER_DB_PROVIDER"; // Name of the storage provider
    it's supposed to be BINNER_DB_PROVIDER

  2. This one I'm not that certain in, because I'm struggling to read C#. This seems to access a dictionary by plain keys like Host:

    var host = configuration.ProviderConfiguration
    .Where(x => x.Key == "Host")
    .Select(x => x.Value)
    .FirstOrDefault();

    While this sets dictionary by using env var names, like BINNER_DB_HOST:
    var dbHost = System.Environment.GetEnvironmentVariable(EnvironmentVarConstants.StorageProviderHost);
    if (!string.IsNullOrEmpty(dbHost))
    storageProviderConfig.ProviderConfiguration[EnvironmentVarConstants.StorageProviderHost] = dbHost;

    So if I'm correct those env vars are never actually read. Currently I'm getting an error saying Host can't be null, even though env shows otherwise:

> echo $BINNER_DB_HOST
binner-pg-rw

(Don't worry about host name being weird, k8s DNS handles that fine)

Would you like to attach your appsetings.json configuration?

No response

Screenshots or Videos (Optional, but they help!)

No response

Are you able to contribute a PR? (No is ok!)

None

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingin-progressThis ticket is currently being worked on

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions