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

Changed path to .cert and .key files to use env vars #192

Merged
merged 2 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ Enables sending notifications to a Discord channel whenever a tracked channel go

Requires the `ENABLE_TWITCH` variable to be set to `TRUE` in order to function.

Set the `TEMP_BEARER_FILE` to anything you like, this will be the file where your bearer token is stored for reuse.

### Creating your self-signed SSL keys:

1. Create the Certificate Authority (CA) private key:
Expand Down Expand Up @@ -245,7 +247,9 @@ $ openssl req -new -out reqout.txt -key server.key
$ openssl x509 -req -in reqout.txt -days 3650 -sha1 -CAcreateserial -CA root.crt -CAkey servercakey.pem -out server.crt
```

6. Move the `server.crt` file and `server.key` to the root file directory of the bot (i.e., the same directory as your `.env` etc.)
6. Move your `server.crt` and `server.key` files into the root of the project. (Level above src)

7. Set the environment variable `SSL_CERT_FILE` to the name of your `server.crt` file and the variable `SSL_KEY_FILE` to the name of your `server.key` file.

### Getting your Twitch Credentials:

Expand Down
2 changes: 2 additions & 0 deletions secrets.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ TWITCH_CLIENT_SECRET=
TWITCH_SUB_SECRET=
TWITCH_CALLBACK=
TEMP_BEARER_FILE=
SSL_CERT_FILE=
SSL_KEY_FILE=
#################

## Twitter Vars ##
Expand Down
5 changes: 4 additions & 1 deletion src/esportsbot/cogs/TwitchCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,10 @@ def setup_http_listener():

# Setup the TwitchListener to listen for /webhook requests.
app = TwitchApp([(r"/webhook", TwitchListener)])
http_server = HTTPServer(app, ssl_options={"certfile": "../server.crt", "keyfile": "../server.key"})
http_server = HTTPServer(app,
ssl_options={"certfile": f"../{os.getenv('SSL_CERT_FILE')}",
"keyfile": f"../{os.getenv('SSL_KEY_FILE')}"}
)
http_server.listen(443)
return http_server, app

Expand Down