From 05452b46b8005daaa5788d01e01527a371985ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8C=E1=85=B5=E1=84=8E=E1=85=A1=E1=86=AB=E1=84=80?= =?UTF-8?q?=E1=85=B2?= Date: Mon, 6 Mar 2023 00:27:02 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Readme=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8,=20settings=20default=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env_sample | 5 +- README.md | 133 +++++++++++++++++++++++++++-------------------- conf/settings.py | 24 +++++++-- 3 files changed, 97 insertions(+), 65 deletions(-) diff --git a/.env_sample b/.env_sample index ee112d9..eaf5bd3 100644 --- a/.env_sample +++ b/.env_sample @@ -8,8 +8,7 @@ DB_USERNAME="root" DB_PASSWORD="root" SLACK_TOKEN="" -SLACK_CHANNEL="" -BOT_NAME="" +BOT_NAME="heymojiBOT" ERROR_CHANNEL="" SPECIAL_EMOJI="trophy" # ๐Ÿ† @@ -24,5 +23,5 @@ ALLOWED_EMOJI_TYPES='[ {"emoji": "๐Ÿ†๏ธ", "emoji_names": ["trophy", "ํŠธ๋กœํ”ผ"]} ]' -RANK_URL="" +RANK_URL="http://127.0.0.1:8080/" DEFAULT_AVATAR_URL="" diff --git a/README.md b/README.md index 924cbed..b2acade 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,16 @@

+ + + # Hey + Emoji = Heymoji + ### ๊ฐœ๋ฐœ์ž์˜ ํ•œ๋งˆ๋”” ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป -๋งํฌ๋“œ์ธ์—์„œ ๋งคํ”„ ๋ฉค๋ฒ„๋“ค์ด ์„œ๋กœ ํ† ๋งˆํ† ๋ฅผ ์ฃผ๋Š” ์ด์œ ๋Š”? ๋ผ๋Š” ๊ธ€์„ ์ฝ๊ณ , ์Šฌ๋ž™ ์ด๋ชจ์ง€(Emoji)๋กœ ๋ฉค๋ฒ„๋“ค์—๊ฒŒ ``์นญ์ฐฌ``์ด๋‚˜ ``๋ฆฌ์ŠคํŽ™`` ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธํ™”๊ฐ€ ์ƒ๊ธด๋‹ค๋ฉด ์žฌ๋ฐŒ๊ธฐ๋„ ํ•˜๊ณ  ๊ณ ๋งˆ์›€๋„ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•˜์Šต๋‹ˆ๋‹ค.
+ +๋งํฌ๋“œ์ธ์—์„œ
+๋งคํ”„ ๋ฉค๋ฒ„๋“ค์ด ์„œ๋กœ ํ† ๋งˆํ† ๋ฅผ ์ฃผ๋Š” ์ด์œ ๋Š”? ๋ผ๋Š” ๊ธ€์„ ์ฝ๊ณ , ์Šฌ๋ž™ ์ด๋ชจ์ง€(Emoji)๋กœ ๋ฉค๋ฒ„๋“ค์—๊ฒŒ ``์นญ์ฐฌ``์ด๋‚˜ ``๋ฆฌ์ŠคํŽ™`` ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธํ™”๊ฐ€ ์ƒ๊ธด๋‹ค๋ฉด ์žฌ๋ฐŒ๊ธฐ๋„ ํ•˜๊ณ  ๊ณ ๋งˆ์›€๋„ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ +๊ฐ™์•˜์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ์ด๋Ÿฐ ์žฌ๋ฏธ๋‚œ ๊ธฐ๋Šฅ์€ ์˜คํ”ˆ์†Œ์Šค๋กœ ๊ณต๊ฐœํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ ํ† ์ด ํ”„๋กœ์ ํŠธ๋กœ ๋งŒ๋“ค์–ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.
(๊ทผ๋ฐ Nodejs๋กœ ๋งŒ๋“ค์–ด์ง„๊ฒŒ ์ด๋ฏธ ์žˆ์—ˆ๋„ค์š”
heyburrito)

@@ -13,19 +20,22 @@ FastAPI์— ๊ตฌ์กฐ๋‚˜ ํ”„๋กœ์ ํŠธ ๊ด€๋ จ๋œ ์ถ”๊ฐ€๊ธฐ๋Šฅ, ๊ฐœ์„ ์‚ฌํ•ญ `PR`์€
-## ๐Ÿ‘‹ ๊ฐœ์š” +## ๐Ÿ‘‹ ๊ฐœ์š” + ํ—ค์ด๋ชจ์ง€ -`Heymoji` API์„œ๋ฒ„๋Š” `Python 3.10`, `FastAPI` ๋กœ ๊ฐœ๋ฐœ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
+`Heymoji` API์„œ๋ฒ„๋Š” `Python 3.10`, `FastAPI` ๋กœ ๊ฐœ๋ฐœ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
๊ทธ ์™ธ ๋ฒ„์ „์—์„œ ํŒจํ‚ค์ง€ ๋ฐ ๋™์ž‘์— ๋Œ€ํ•œ ํ˜ธํ™˜์€ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. (๊ทผ๋ฐ ๊ฑฐ์˜ ๋‹ค ๋ ๊ฑฐ์—์š” python3.7 ์ด์ƒ์ด๋ฉด...์•„๋งˆ๋‘~๐Ÿ˜ )
ํ”„๋ก ํŠธ์—”๋“œ๋Š” `vuejs`๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ฐ„๋‹จํžˆ ๋งŒ๋“ค์–ด ๋ดค์Šต๋‹ˆ๋‹ค!
-## ๐Ÿ›  ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ -์ฒ˜์Œ `Heymoji`๋ฅผ ๊ฐœ๋ฐœํ• ๋•Œ๋Š” DDD ๊ตฌ์กฐ๊ฐ€ ์•„๋‹ˆ์—ˆ์Šต๋‹ˆ๋‹ค.
-DDD์— ๋Œ€ํ•œ ์Šคํ„ฐ๋””๋ฅผ ์œ„ํ•ด ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์œผ๋ฉฐ https://github.com/Ermlab/python-ddd ๋ฅผ ์ฐธ๊ณ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
+## ๐Ÿ›  ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ + +์ฒ˜์Œ `Heymoji`๋ฅผ ๊ฐœ๋ฐœํ• ๋•Œ๋Š” DDD ๊ตฌ์กฐ๊ฐ€ ์•„๋‹ˆ์—ˆ์Šต๋‹ˆ๋‹ค.
+DDD์— ๋Œ€ํ•œ ์Šคํ„ฐ๋””๋ฅผ ์œ„ํ•ด ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์œผ๋ฉฐ https://github.com/Ermlab/python-ddd ๋ฅผ ์ฐธ๊ณ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
๋‹ค์†Œ ๋ณต์žกํ•  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ถ”ํ›„ ์œ ์ง€๋ณด์ˆ˜์™€ ์—ฌ๋Ÿฌ ์ƒํƒœ๋ณ€๊ฒฝ์ด ์ผ์–ด๋‚˜๋Š” ๊ฒฝ์šฐ DDD๊ฐ€ ์ข€ ๋” ์œ ์—ฐํ•  ๊ฑฐ๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค๐Ÿ˜ + ``` โ”œโ”€โ”€ apps | โ”œโ”€ api @@ -59,76 +69,91 @@ DDD์— ๋Œ€ํ•œ ์Šคํ„ฐ๋””๋ฅผ ์œ„ํ•ด ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์œผ๋ฉฐ https://github.com/E
-## ๐Ÿ’พ ์„ธํŒ… +## ๐Ÿ’พ ์„ธํŒ… + `.env_sample`์„ ์ฐธ๊ณ ํ•ด์„œ `.env`ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
์›ํ•˜์‹œ๋Š” ์„ธํŒ…์œผ๋กœ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋“ค์„ ์„ธํŒ…ํ•ฉ๋‹ˆ๋‹ค.
DB๋Š” `MySQL`์„ ์‚ฌ์šฉํ•˜๋ฉฐ ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด `aiomysql`๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
๋‹ค๋ฅธ DB ์‚ฌ์šฉํ•˜๋ ค๋ฉด `config` ์„ค์ •์ด ์กฐ๊ธˆ ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. -| ์ด๋ฆ„ |์„ค๋ช…| -|---------------------|----| -| ENV |๋ฐฐํฌํ™˜๊ฒฝ ์ •์˜| -| REACTION_LIST |์›นํ›… ๋ฆฌ์•ก์…˜์œผ๋กœ ํ—ˆ์šฉ๋œ ์ด๋ชจ์ง€(reaction)๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.| -| ALLOWED_EMOJI_TYPES |ํ•ธ๋“ค๋งํ•  ์ด๋ชจ์ง€๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.| -| DAY_MAX_REACTION |ํ•˜๋ฃจ ์ตœ๋Œ€ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Reaction ๊ฐœ์ˆ˜ (optinal)| -| SLACK_TOKEN |์Šฌ๋ž™ ํ† ํฐ| -| BOT_NAME |์Šฌ๋ž™๋ด‡ ์ด๋ฆ„| -| ERROR_CHANNEL |์Šฌ๋ž™ ์—๋Ÿฌ ๋ฆฌํฌํŒ… ์ฑ„๋„| -| DB_HOST |DB ํ˜ธ์ŠคํŠธ| -| DB_PORT |DB ํฌํŠธ| -| DATABASE |DB ์ด๋ฆ„| -| DB_USERNAME |DB ์ ‘์† ์œ ์ €๋„ค์ž„| -| DB_PASSWORD |DB ํŒจ์Šค์›Œ๋“œ| -| DEFAULT_AVATAR_URL |๊ธฐ๋ณธ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ URL| +| ์ด๋ฆ„ | ์„ค๋ช… | +|-----------------------------------|-------------------------------------| +| ENV | ๋ฐฐํฌํ™˜๊ฒฝ ์ •์˜ | +| ALLOW_ORIGINS | CORS๋ฅผ ํ—ˆ์šฉํ•  ORIGIN ๋ฆฌ์ŠคํŠธ | +| DB_HOST | DB ํ˜ธ์ŠคํŠธ | +| DB_PORT | DB ํฌํŠธ | +| DATABASE | DB ์ด๋ฆ„ | +| DB_USERNAME | DB ์ ‘์† ์œ ์ €๋„ค์ž„ | +| DB_PASSWORD | DB ํŒจ์Šค์›Œ๋“œ | +| SLACK_TOKEN | ์Šฌ๋ž™ ํ† ํฐ | +| BOT_NAME | ์Šฌ๋ž™๋ด‡ ์ด๋ฆ„ | +| ERROR_CHANNEL | ์Šฌ๋ž™ ์—๋Ÿฌ ๋ฆฌํฌํŒ… ์ฑ„๋„ | +| SPECIAL_EMOJI | ํŠน๋ณ„ํ•œ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง„ ์ด๋ชจ์ง€ | +| LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI | ํ•˜๋ฃจ์— ๋‚จ๊ธธ์ˆ˜ ์žˆ๋Š” SPECIAL_EMOJI ์ตœ๋Œ€ ๊ฐœ์ˆ˜ | +| ALLOWED_REACTION_LIST | ์›นํ›… ๋ฆฌ์•ก์…˜์œผ๋กœ ํ—ˆ์šฉ๋œ ์ด๋ชจ์ง€(reaction)๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. | +| ALLOWED_EMOJI_TYPES | ํ•ธ๋“ค๋งํ•  ์ด๋ชจ์ง€๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. | +| RANK_URL | ๋žญํ‚น ์›นํŽ˜์ด์ง€ URK | +| DEFAULT_AVATAR_URL | ๊ธฐ๋ณธ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ URL |
-## ๐Ÿณ Docker-Compose ์‹คํ–‰ +## ๐Ÿณ Docker-Compose ์‹คํ–‰ + `.env_sample`์„ ์ฐธ๊ณ ํ•˜์—ฌ`.env`ํŒŒ์ผ์„ ์ƒ์„ฑํ•œ ๋’ค `docker-compose up -d` ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
api, web, db ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋ชจ๋‘ ์‹คํ–‰ ๋œ ํ›„ http://127.0.0.1:8080 ์— ์ ‘์†ํ•˜์—ฌ ๋™์ž‘์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
โ—๏ธ์ฃผ์˜: ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋œจ๊ณ  ํŒจํ‚ค์ง€ ์„ค์น˜์— ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด์ˆ˜ ์žˆ์–ด์„œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹คํ–‰๊นŒ์ง€ ๋ช‡๋ถ„์ด ์†Œ์š” ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2023-01-02 แ„‹แ…ฉแ„’แ…ฎ 10 54 35 -`docker-comopse` ์‹คํ–‰ ์ „์— README ํ•˜๋‹จ์— ์žˆ๋Š” Slack Bot ์„ค์ •์„ ๋จผ์ € ๋ณด์‹œ๊ณ  `SlackToken` ๊ฐ™์€ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ๋จผ์ € ์ฃผ์ž…ํ•ด์ฃผ์„ธ์š”! +`docker-comopse` ์‹คํ–‰ ์ „์— README ํ•˜๋‹จ์— ์žˆ๋Š” +Slack Bot ์„ค์ •์„ ๋จผ์ € ๋ณด์‹œ๊ณ  `SlackToken` ๊ฐ™์€ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ๋จผ์ € ์ฃผ์ž…ํ•ด์ฃผ์„ธ์š”!
-## ๐Ÿ’ก ๋กœ์ปฌ ์‹คํ–‰ +## ๐Ÿ’ก ๋กœ์ปฌ ์‹คํ–‰ + ``` pip install -r requirements ``` + `root๊ฒฝ๋กœ`(/heymoji) ์— ๊ฐ€์„œ uvicorn์œผ๋กœ ์„œ๋ฒ„๋ฅผ ์‹คํ–‰์‹œํ‚ต๋‹ˆ๋‹ค.
๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” `&`๋ฅผ ๋งˆ์ง€๋ง‰์— ๋ถ™์—ฌ์ฃผ์„ธ์š”. + ``` uvicorn app.main:app --port 8080 ``` + ๋งŒ์•ฝ ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์‹คํ–‰๋˜๊ณ  ์žˆ๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ์ œ๊ฑฐํ•˜๊ณ ์‹ถ์€ ๊ฒฝ์šฐ + ``` 1. ps aux | grep uvicorn 2. kill -9 {PID} ``` + ์ž˜๋ชป๋œ ํ”„๋กœ์„ธ์Šค kill์„ ์ฃผ์˜ํ•˜์„ธ์š”!

-## ๐Ÿ“ API ๋ฌธ์„œ ๋ฐ ํ…Œ์ŠคํŠธ -``HOST_URL/docs``๋กœ ์ ‘์†ํ•˜๋ฉด ``Swagger``๋กœ ๋งŒ๋“ค์–ด์ง„ web ํŽ˜์ด์ง€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (FastAPI๋Š” swagger, redoc ์ง€์›) - +## ๐Ÿ“ API ๋ฌธ์„œ ๋ฐ ํ…Œ์ŠคํŠธ + +``HOST_URL/docs``๋กœ ์ ‘์†ํ•˜๋ฉด ``Swagger``๋กœ ๋งŒ๋“ค์–ด์ง„ web ํŽ˜์ด์ง€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (FastAPI๋Š” swagger, redoc ์ง€์›) + +API ๋ฌธ์„œ ๋ฐ ํ…Œ์ŠคํŠธ +

-## ๐Ÿ‘พ ์Šฌ๋ž™ ๋งจ์…˜ ๋ช…๋ น์–ด -|์ด๋ฆ„|์„ค๋ช…| -|----|----| -|help|์ปค๋ฉ˜๋“œ ๊ด€๋ จ help| -|create_user|user ์ƒ์„ฑ| -|update_user|user ์ •๋ณด ์—…๋ฐ์ดํŠธ| -|show_user|์œ ์ € is_display = True (๋…ธ์ถœ)| -|hide_user|์œ ์ € is_display = False (์ˆจ๊น€)| -|show_best_member|ํ•ด๋‹น์›” ๋ฒ ์ŠคํŠธ ๋ฉค๋ฒ„ ์ถ”์ถœ| +## ๐Ÿ‘พ ์Šฌ๋ž™ ๋งจ์…˜ ๋ช…๋ น์–ด +| ์ด๋ฆ„ | ์„ค๋ช… | +|------------------|----------------------------| +| help | ์ปค๋ฉ˜๋“œ ๊ด€๋ จ help | +| create_user | user ์ƒ์„ฑ | +| update_user | user ์ •๋ณด ์—…๋ฐ์ดํŠธ | +| show_user | ์œ ์ € is_display = True (๋…ธ์ถœ) | +| hide_user | ์œ ์ € is_display = False (์ˆจ๊น€) | +| show_best_member | ํ•ด๋‹น์›” ๋ฒ ์ŠคํŠธ ๋ฉค๋ฒ„ ์ถ”์ถœ | ``` ๐Ÿฅณ ๋ฉค๋ฒ„ ๋“ฑ๋ก @@ -148,14 +173,21 @@ uvicorn app.main:app --port 8080 ๐Ÿ™‰ ์œ ์ € ๋ณด์ด๊ธฐ @EmojiBot --show_user --slack_id=์Šฌ๋ž™ID ``` +### ๐ŸŽ– show_best_member ์˜ˆ์‹œ + +show_best_member ์˜ˆ์‹œ ### ๐Ÿš€ Postman ์œผ๋กœ ์œ ์ € ๋“ฑ๋ก ์˜ˆ์‹œ -ํฌ์ŠคํŠธ๋งจ ๋“ฑ๋ก ์˜ˆ์‹œ + +ํฌ์ŠคํŠธ๋งจ ๋“ฑ๋ก ์˜ˆ์‹œ
+
+ +## ๐ŸงŸโ€โ™‚๏ธ ํ”„๋กœ์„ธ์Šค Live ์ฒดํฌ (์„ ํƒ) -## ๐ŸงŸโ€โ™‚๏ธ ํ”„๋กœ์„ธ์Šค Live ์ฒดํฌ (์„ ํƒ) shell script๋กœ ๊ฐ„๋‹จํ•˜๊ฒŒ Live ์ฒดํฌ๋ฅผ ์ง„ํ–‰ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค! ํฌ๋ก ํƒญ์— 1๋ถ„๋งˆ๋‹ค ์‹คํ–‰ํ•˜๋„๋ก ๋“ฑ๋ก.
๋กœ๊น…๋„ ์ถ”๊ฐ€ํ•˜๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค. + ``` #! /bin/bash PYTHON_PATH=/{{ path }}/venv/bin/python @@ -168,24 +200,10 @@ if [ "$checker" == "0" ]; then cd $SCRIPT_PATH && `uvicorn main:app --port 8080 &` fi ``` - -## ~๐Ÿƒ๐Ÿปโ€ ๋ฐฐ์น˜ ์Šคํฌ๋ฆฝํŠธ ํฌ๋ก ํƒญ ๋“ฑ๋ก~ -~๋ฉค๋ฒ„๋‹น ํ•˜๋ฃจ์— ํ—ˆ์šฉ๋œ ``DAY_MAX_REACTION`` ๋งŒํผ ์ด๋ชจ์ง€(Emoji)๋ฅผ ๋‹ค๋ฅธ ๋ฉค๋ฒ„์—๊ฒŒ ์ค„ ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.~
-~๋งค์ผ ์ž์ •์— ๋‹ค์‹œ ``DAY_MAX_REACTION``๋งŒํผ ์นด์šดํŠธ๋ฅผ ๋ฆฌ์…‹ํ•˜๋Š” ๋ฐฐ์น˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ``ํฌ๋ก ํƒญ``์— ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.~
-~์ €๋Š” ``์‰˜์Šคํฌ๋ฆฝํŠธ``๋ฅผ ๋งŒ๋“ค์–ด์„œ ``ํฌ๋ก ํƒญ``์— ๋“ฑ๋กํ–ˆ์Šต๋‹ˆ๋‹ค.~ -``` -#!/bin/bash - -PYTHON_PATH=/{{ path }}/venv/bin/python -SCRIPT_PATH=/{{ path }}/heymoji/scripts/update_emoji_count.py - -source '{{ path }}/venv/bin/activate' - -$PYTHON_PATH $SCRIPT_PATH -```
-# ๐Ÿค– Slack Bot ์„ค์ • +# ๐Ÿค– Slack Bot ์„ค์ • + https://api.slack.com/apps ์— ์ ‘์†ํ•˜์—ฌ create app ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ ํ›„,
@@ -194,7 +212,7 @@ https://api.slack.com/apps ์— ์ ‘์†ํ•˜์—ฌ create app ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ ํ›„, `Basic Information` ํƒญ์„ ํด๋ฆญํ›„ ํ•˜๋‹จ์—์„œ app์˜ ``ํ”„๋กœํ•„ ์ด๋ฏธ์ง€``๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  Save ํ•ด์ค๋‹ˆ๋‹ค.
-์ด๊ฑด ์•ˆํ•ด๋„ ๋˜์ง€๋งŒ ํ•˜๋Š”๊ฒŒ ์ข‹์•„์š”. ์™œ๋ƒํ•˜๋ฉด ๋ฉ‹์žˆ๊ฑฐ๋“ ์š”๐Ÿ˜Ž +์ด๊ฑด ์•ˆํ•ด๋„ ๋˜์ง€๋งŒ ํ•˜๋Š”๊ฒŒ ์ข‹์•„์š”. ์™œ๋ƒํ•˜๋ฉด ๋ฉ‹์žˆ๊ฑฐ๋“ ์š”๐Ÿ˜Ž @@ -210,7 +228,8 @@ https://api.slack.com/apps ์— ์ ‘์†ํ•˜์—ฌ create app ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ ํ›„, -๋กœ์ปฌ์—์„œ ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ ์œ„ํ•ด ngrok์„ ์‚ฌ์šฉํ•˜์‹œ๋ฉด ํŽธํ•ฉ๋‹ˆ๋‹ค.์‹ค์ œ prod ํ™˜๊ฒฝ์—์„œ๋Š” `Nginx + uvicorn`์œผ๋กœ ์‹คํ–‰ํ•˜๋ฉด ๋˜์š”! +๋กœ์ปฌ์—์„œ ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ ์œ„ํ•ด ngrok์„ ์‚ฌ์šฉํ•˜์‹œ๋ฉด ํŽธํ•ฉ๋‹ˆ๋‹ค.์‹ค์ œ prod +ํ™˜๊ฒฝ์—์„œ๋Š” `Nginx + uvicorn`์œผ๋กœ ์‹คํ–‰ํ•˜๋ฉด ๋˜์š”!
Nginx Config ์—์„œ `proxy_pass` ๋งŒ uvicorn์œผ๋กœ ์‹คํ–‰ํ•œ ๋กœ์ปฌ ์„œ๋ฒ„๋กœ ์—ฐ๊ฒฐํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค!
diff --git a/conf/settings.py b/conf/settings.py index a5020c9..80a54f3 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -21,13 +21,27 @@ class BaseConfig(BaseSettings): DB_PASSWORD: str = Field(env="DB_PASSWORD", default="root") DATABASE: str = Field(env="DATABASE", default="heymoji") + SLACK_TOKEN: str = Field(env="SLACK_TOKEN", default="") + ERROR_CHANNEL: str = Field(env="ERROR_CHANNEL", default="") + BOT_NAME: str = Field(env="BOT_NAME", default="heymojiBOT") + SPECIAL_EMOJI: Optional[str] = Field(env="SPECIAL_EMOJI", default="trophy") LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI: int = Field(env="LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI", default=5) - ALLOWED_REACTION_LIST: list = Field(env="ALLOWED_REACTION_LIST", default=['heart']) - SLACK_TOKEN: str = Field(env="SLACK_TOKEN") - ERROR_CHANNEL: str = Field(env="ERROR_CHANNEL") - BOT_NAME: str = Field(env="BOT_NAME") - ALLOWED_EMOJI_TYPES: list = Field(env="ALLOWED_EMOJI_TYPES", default=[]) + ALLOWED_REACTION_LIST: list = Field( + env="ALLOWED_REACTION_LIST", + default=["pray", "heart", "eye_shaking", "+1", "๊ธฐ๋„", "๊ธฐ์จ", "kkkk", "trophy", "ํŠธ๋กœํ”ผ"] + ) + ALLOWED_EMOJI_TYPES: list = Field( + env="ALLOWED_EMOJI_TYPES", + default=[ + {"emoji": "โค๏ธ", "emoji_names": ["heart"]}, + {"emoji": "๐Ÿคฃ", "emoji_names": ["kkkk", "๊ธฐ์จ"]}, + {"emoji": "๐Ÿ™๏ธ", "emoji_names": ["pray", "๊ธฐ๋„"]}, + {"emoji": "๐Ÿ‘", "emoji_names": ["+1"]}, + {"emoji": "๐Ÿ‘€๏ธ", "emoji_names": ["eye_shaking"]}, + {"emoji": "๐Ÿ†๏ธ", "emoji_names": ["trophy", "ํŠธ๋กœํ”ผ"]} + ] + ) RANK_URL: str = Field(env="RANK_URL", default="") DEFAULT_AVATAR_URL: str = Field(