-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70df976
commit 1111203
Showing
12 changed files
with
140 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,28 @@ | ||
# cfc_chat_transit | ||
Paving paths and establishing tunnels | ||
|
||
## Convars | ||
|
||
### Server | ||
- **`cfc_avatar_service_address`** | ||
- The domain (`avatar_api.mydomain.com`) of the Avatar Service API | ||
|
||
- **`cfc_avatar_service_image_address`** | ||
- The domain (`avatars.mydomain.com`) that the Avatar images are actually served from | ||
|
||
- **`cfc_relay_host`** | ||
- The domain (`relay.mydomain.com`) of the `discord_relay` service | ||
|
||
- `cfc_realm` | ||
- The Realm (`cfc3` / `cfcttt` / `darkrp`) of the server that is running the addon | ||
|
||
- **`cfc_chat_transit_should_transmit_remote`** | ||
- Whether or not to send Discord messages to players | ||
|
||
- **`cfc_chat_transit_transmit_admin_only`** | ||
- Whether or not to send Discord messages to only Admin+ | ||
|
||
|
||
### Client | ||
- **`cfc_chat_transit_remote_messages`** | ||
- Whether or not Discord messages should appear in Chat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
PORT=9101 | ||
API_PORT=9100 | ||
AVATARS_DIR="/some/path/to/a/dir/on/host" | ||
AVATAR_SERVICE_URL="https://avatars.mydomain.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PORT=9103 | ||
SENTRY_DSN="https://dc69197dffc94fcf8cc025c5f00ead45@o380324.ingest.sentry.io/5636934" | ||
DISCORD_TOKEN="LQx6IeNs9mtFICwrrB1xqMB2Fgl5-fvf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package webhook | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"sync" | ||
) | ||
|
||
type WebhookInfo struct { | ||
ID string | ||
Secret string | ||
} | ||
|
||
var cache = make(map[string]*WebhookInfo) | ||
var mu sync.Mutex | ||
|
||
func Get(realm string) *WebhookInfo { | ||
mu.Lock() | ||
defer mu.Unlock() | ||
|
||
if info, exists := cache[realm]; exists { | ||
return info | ||
} | ||
|
||
// Expects cfc3_WEBHOOK_ID / cfc3_WEBHOOK_SECRET | ||
idEnv := fmt.Sprintf("%s_WEBHOOK_ID", realm) | ||
secretEnv := fmt.Sprintf("%s_WEBHOOK_SECRET", realm) | ||
|
||
id := os.Getenv(idEnv) | ||
secret := os.Getenv(secretEnv) | ||
|
||
info := &WebhookInfo{ | ||
ID: id, | ||
Secret: secret, | ||
} | ||
|
||
cache[realm] = info | ||
return info | ||
} |