42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.61k stars 615 forks source link

Unable to use .env to set passwords etc. #1867

Open lindhe opened 2 years ago

lindhe commented 2 years ago

Describe the bug

When I deploy Matterbridge using docker-compose, I expect to be able to use .env to populate sensitive passwords etc. as described in the Wiki, but I simply cannot get it to work. I've tried many different variants without success. I suspect that it's broken or maybe the documentation is misleading.

To Reproduce

Steps to reproduce the behavior: https://github.com/42wim/matterbridge/wiki/Gateway-config-%28basic%29#environment-variables

Expected behavior

When I deploy Matterbridge using docker-compose, I expect to be able to use .env to populate sensitive passwords etc. as described in the Wiki.

Environment (please complete the following information):

Additional context

Related to #50.

My matterbridge.toml:

[irc.tgbot]
Server="irc.example.com:6697"
RemoteNickFormat="<tg-{NICK}> "
UseTLS=true
SkipTLSVerify=true
Nick="telegrambot"
#Password="notmyrealpassword"
Charset="utf-8"

[telegram.myirc]
#Token="123456789:NOT_MY_REAL_TOKEN_NOT_MY_REAL_TOKEN"
RemoteNickFormat="&lt;{NICK}&gt; "
MessageFormat="HTMLNick"

[[gateway]]
name="tg_my_gw"
enable=true

    [[gateway.inout]]
    account="irc.tgbot"
    channel="#debug"

    [[gateway.inout]]
    account="telegram.myirc"
    channel="-1234567890123"

My .env:

MATTERBRIDGE_IRC_TGBOT_PASSWORD='notmyrealpassword'
MATTERBRIDGE_TELEGRAM_MYIRC_TOKEN=123456789:NOT_MY_REAL_TOKEN_NOT_MY_REAL_TOKEN

A partially related question, which is basically just a documentation issue, is whether or not it works for gateway configurations too or only accounts?

bd808 commented 1 year ago

@lindhe Have you declared the envvars that your .env file would populate in your docker-compose.yaml? That would typically look something like:

version: '3.7'
services:
  matterbridge:
    image: 42wim/matterbridge:stable
    restart: unless-stopped
    environment:
    - MATTERBRIDGE_IRC_TGBOT_PASSWORD
    - MATTERBRIDGE_TELEGRAM_MYIRC_TOKEN
    volumes:
    - ./matterbridge.toml:/etc/matterbridge/matterbridge.toml:ro
lindhe commented 1 year ago

No, since that's not documented in the wiki. 😅