• Matthew Slipper's avatar
    go/proxyd: Add support for env vars in the config · 73484138
    Matthew Slipper authored
    Certain config parameters can now be read from the environment if environment variables as provided as config values. The following parameters can be read from the environment:
    
    - `backends.*.rpc_url`
    - `backends.*.ws_url`
    - `backends.*.password`
    - `authentication.*`
    
    Example backend config:
    
    ```toml
    [backends]
    [backends.from_env]
    rpc_url = "$SECRET_RPC_URL"
    ws_url = "$SECRET_WS_URL"
    ```
    
    Example authentication config. Note the additional double quotes around the secret key:
    
    ```toml
    [authentication]
    "$SECRET_AUTH_KEY" = "auth_key_alias"
    ```
    
    Env vars can be escaped with two backslashes (`\\`). We have to use two backslashes because it's also the escape character in TOML.
    
    Env vars defined in the config but not defined in the actual environment will result in an error that prevents `proxyd` from starting.
    
    Metadata:
    
    - Fixes: ENG-1728
    73484138
example.config.toml 2.67 KB