Skip to content

Configuration through environment variables #24

Closed

Description

@andrebrait

Is your feature request related to a problem? Please describe.
I want to create an unRAID template for this image, but unRAID does not make it easy for the end users to customize arguments passed to the command. It is possible for the template creator to add them, but it's all in a single line of text. Since it doesn't seem they're gonna change that anytime soon, I thought making this image configurable via environment variables would probably be easier.

Describe the solution you'd like
Make it possible to configure this with environment variables roughly equivalent to the the command line arguments that are available.

Describe alternatives you've considered
Eventually propose a PR for the Unraid webGUI so that it can add command line arguments in a better way and/or have full support for Docker compose syntax.

Activity

  1. self-assigned this
    on Aug 6, 2024
  2. wollomatic commented on Aug 6, 2024

    @wollomatic
    Owner

    Hello @andrebrait,

    thanks for your suggestion. I will have the time to implement this in the following days.

  3. andrebrait commented on Aug 8, 2024

    @andrebrait
    Author

    I'm not too familiar with golang, but this seems to implement a somewhat similar interface to the argument parser I found in internal/config/config.go: https://github.com/caarlos0/env

  4. andrebrait commented on Aug 8, 2024

    @andrebrait
    Author

    Repeatable arguments are not easy to map into environment variables (e.g. if you have several GET endpoints you want to allow without some very creative regex). I think Collabora Code solves it by essentially having variables like aliasgroup1, aliasgroup2, ..., aliasgroupN. Does it look good? No. Does it work? Probably 😜

  5. wollomatic commented on Aug 8, 2024

    @wollomatic
    Owner

    Hi @andrebrait,

    thanks again for Your input. For security reasons, I avoid using external dependencies other than the Go standard library in this project.

    There is no need to use more than one allowlist configuration for one http method. You can handle multipe http endpoints with one regexp, see the example for watchtower below. More endpoints would make the regexp complex, I know. But I recommend using one separate socket-proxy for each service.

    I just created a testing image: docker pull wollomatic/socket-proxy:testing

    services:
      dockerproxy:
        image: wollomatic/socket-proxy:testing
    #    command:
    #      - -loglevel=info
    #      - -allowfrom=watchtower
    #      - -listenip=0.0.0.0
    #      - '-allowGET=/v1\..{2}/(containers/.*|images/.*)'
    #      - '-allowPOST=/v1\..{2}/(containers/.*|images/.*|networks/.*)'
    #      - '-allowDELETE=/v1\..{2}/(containers/.*|images/.*)'
    #      - -watchdoginterval=300
    #      - -stoponwatchdog
    #      - -shutdowngracetime=30
        environment:
          SP_LOGLEVEL: info
          SP_ALLOWFROM: watchtower
          SP_LISTENIP: 0.0.0.0
          SP_ALLOW_GET: /v1\..{2}/(containers/.*|images/.*)
          SP_ALLOW_POST: /v1\..{2}/(containers/.*|images/.*|networks/.*)
          SP_ALLOW_DELETE: /v1\..{2}/(containers/.*|images/.*)
          SP_WATCHDOGINTERVAL: 300
          SP_STOPONWATCHDOG: true
          SP_SHUTDOWNGRACETIME: 30
        restart: unless-stopped
        read_only: true
        mem_limit: 64M
        cap_drop:
          - ALL
        security_opt:
          - no-new-privileges
        user: 65534:999
        labels:
          - com.centurylinklabs.watchtower.enable=false
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock:ro
        networks:
          - docker-proxynet
    

    A first integration test shows the configuration works.

    I also updated the README.md in the develop branch.

  6. wollomatic commented on Aug 10, 2024

    @wollomatic
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions