Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up multiple accounts #28

Closed
whatnik opened this issue Dec 6, 2022 · 4 comments · Fixed by #29
Closed

Set up multiple accounts #28

whatnik opened this issue Dec 6, 2022 · 4 comments · Fixed by #29

Comments

@whatnik
Copy link

whatnik commented Dec 6, 2022

For example like this:
3proxy.cfg.json

...
  "max_connections": "1024",
  "auth": [
    {
      "login": "user1",
      "password": "pass1"
    },
    {
      "login": "user2",
      "password": "pass2"
    }
  ],
  "ports": {
...

3proxy.cfg.mustach

...
maxconn {{ max_connections }}

users{{#auth}}{{#login}} "{{ . }}{{/login}}:CL:{{#password}}{{ . }}"{{/password}}{{/auth}}

auth strong
{{#auth}}
allow {{#login}}{{ . }}{{/login}}
{{/auth}}

proxy -a -p{{ ports.proxy }}
...

To separate users by commas, you need to conjure. https://stackoverflow.com/questions/6114435/in-mustache-templating-is-there-an-elegant-way-of-expressing-a-comma-separated-l

@tarampampam
Copy link
Owner

Nice suggestion, but what about environment variables?

@whatnik
Copy link
Author

whatnik commented Dec 6, 2022

While I came up with the idea to transfer as is

...
    image: tarampampam/3proxy
    environment:
        - 'USERS={"login": "user1", "password": "pass1"}, {"login": "user2", "password": "pass2"}'
    ports:
        - 3128:3128/tcp
...
...
  "max_connections": "${MAX_CONNECTIONS:-1024}",
  "auth": [${USERS:-}],
  "ports": {
...

@tarampampam tarampampam mentioned this issue Dec 7, 2022
4 tasks
@tarampampam
Copy link
Owner

tarampampam commented Dec 7, 2022

@whatnik What do you think about changes in PR #29?

It allows using of an additional environment variable EXTRA_ACCOUNTS with a value in the format {"user1": "pass1", "user2": "pass2"} for additional accounts set up.

@whatnik whatnik closed this as completed Dec 7, 2022
@tarampampam
Copy link
Owner

Closed too early, I didn't merge PR yet :D Just want to hear your opinion about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants