mirror of
https://github.com/kurbezz/discord-bot.git
synced 2026-03-03 17:50:47 +01:00
Compare commits
1 Commits
main
...
a78ed61d5b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a78ed61d5b |
43
.github/workflows/build_docker_image.yml
vendored
43
.github/workflows/build_docker_image.yml
vendored
@@ -3,16 +3,18 @@ name: Build docker image
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- 'main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build-Docker-Image:
|
Build-Docker-Image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
-
|
||||||
uses: actions/checkout@v4
|
name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- id: repository_name
|
- id: repository_name
|
||||||
@@ -20,14 +22,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
string: ${{ github.repository }}
|
string: ${{ github.repository }}
|
||||||
|
|
||||||
- name: Login to ghcr.io
|
-
|
||||||
|
name: Login to ghcr.io
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
-
|
||||||
|
name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
env:
|
env:
|
||||||
@@ -39,7 +43,32 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./docker/build.dockerfile
|
file: ./docker/build.dockerfile
|
||||||
|
|
||||||
- name: Invoke deployment hook
|
-
|
||||||
|
name: Invoke deployment hook (game_list)
|
||||||
uses: joelwmale/webhook-action@master
|
uses: joelwmale/webhook-action@master
|
||||||
with:
|
with:
|
||||||
url: ${{ secrets.WEBHOOK_URL }}
|
url: ${{ secrets.WEBHOOK_URL }}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Invoke deployment hook (twitch_webhook)
|
||||||
|
uses: joelwmale/webhook-action@master
|
||||||
|
with:
|
||||||
|
url: ${{ secrets.WEBHOOK_URL_2 }}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Invoke deployment hook (temporal_worker)
|
||||||
|
uses: joelwmale/webhook-action@master
|
||||||
|
with:
|
||||||
|
url: ${{ secrets.WEBHOOK_URL_3 }}
|
||||||
|
|
||||||
|
# -
|
||||||
|
# name: Invoke deployment hook (stream_notifications)
|
||||||
|
# uses: joelwmale/webhook-action@master
|
||||||
|
# with:
|
||||||
|
# url: ${{ secrets.WEBHOOK_URL_4 }}
|
||||||
|
|
||||||
|
# -
|
||||||
|
# name: Invoke deployment hook (web_app)
|
||||||
|
# uses: joelwmale/webhook-action@master
|
||||||
|
# with:
|
||||||
|
# url: ${{ secrets.WEBHOOK_URL_5 }}
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
|
from pydantic import BaseModel
|
||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
|
from httpx import Client
|
||||||
|
|
||||||
class Config(BaseSettings):
|
|
||||||
|
class Settings(BaseSettings):
|
||||||
|
VAULT_HOST: str
|
||||||
|
VAULT_SECRET_PATH: str
|
||||||
|
VAULT_TOKEN: str
|
||||||
|
|
||||||
|
|
||||||
|
class Config(BaseModel):
|
||||||
DISCORD_BOT_TOKEN: str
|
DISCORD_BOT_TOKEN: str
|
||||||
DISCORD_BOT_ID: str
|
DISCORD_BOT_ID: str
|
||||||
DISCORD_BOT_ACTIVITY: str
|
DISCORD_BOT_ACTIVITY: str
|
||||||
@@ -26,7 +35,22 @@ class Config(BaseSettings):
|
|||||||
|
|
||||||
OPENAI_API_KEY: str
|
OPENAI_API_KEY: str
|
||||||
|
|
||||||
TEMPOLAR_URL: str = "temporal:7233"
|
|
||||||
|
def get_config() -> Config:
|
||||||
|
settings = Settings() # type: ignore
|
||||||
|
|
||||||
|
with Client() as client:
|
||||||
|
response = client.get(
|
||||||
|
f"https://{settings.VAULT_HOST}/v1/{settings.VAULT_SECRET_PATH}",
|
||||||
|
headers={
|
||||||
|
"X-Vault-Token": settings.VAULT_TOKEN,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
return Config(**response.json()["data"]["data"])
|
||||||
|
|
||||||
|
|
||||||
config = Config()
|
config = get_config()
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from temporalio.client import Client
|
from temporalio.client import Client
|
||||||
from temporalio.contrib.pydantic import pydantic_data_converter
|
from temporalio.contrib.pydantic import pydantic_data_converter
|
||||||
|
|
||||||
from core.config import config
|
|
||||||
|
|
||||||
|
|
||||||
async def get_client() -> Client:
|
async def get_client() -> Client:
|
||||||
return await Client.connect(
|
return await Client.connect(
|
||||||
config.TEMPOLAR_URL, namespace="default", data_converter=pydantic_data_converter
|
"temporal:7233",
|
||||||
|
namespace="default",
|
||||||
|
data_converter=pydantic_data_converter
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user