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

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions