[image-service] updated ALLOWED_FOLDERS
This commit is contained in:
parent
88351993cf
commit
54ecb2ee8c
3 changed files with 35 additions and 8 deletions
|
|
@ -9,16 +9,31 @@ services:
|
|||
environment:
|
||||
- PYTHONUNBUFFERED=1
|
||||
volumes:
|
||||
- ~/repo/taobin_project:/taobin_project
|
||||
- shared-repo:/usr/src/app
|
||||
# - ~/repo/taobin_project:/taobin_project
|
||||
restart: always
|
||||
command: uvicorn main:app --host 0.0.0.0 --port 8125
|
||||
networks:
|
||||
- kong-net
|
||||
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
container_name: nginx-image-container
|
||||
volumes:
|
||||
- ~/repo/taobin_project:/taobin_project
|
||||
- shared-repo:/usr/src/app
|
||||
# - ~/repo/taobin_project:/taobin_project
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
ports:
|
||||
- "8126:80"
|
||||
networks:
|
||||
- kong-net
|
||||
|
||||
networks:
|
||||
kong-net:
|
||||
external: true
|
||||
name: kong-api-gateway_kong-ee-net
|
||||
|
||||
volumes:
|
||||
shared-repo:
|
||||
external: true
|
||||
|
||||
14
main.py
14
main.py
|
|
@ -7,9 +7,19 @@ import uuid
|
|||
|
||||
app = FastAPI()
|
||||
|
||||
BASE_DIR = Path("/taobin_project")
|
||||
BASE_DIR = Path("/usr/src/app/taobin_project")
|
||||
# BASE_DIR = Path("/taobin_project")
|
||||
|
||||
ALLOWED_FOLDERS = {"page_drink",
|
||||
"page_drink_disable",
|
||||
"page_drink_disable_n",
|
||||
"page_drink_disable_n2",
|
||||
"page_drink_n",
|
||||
"page_drink_picture2_n",
|
||||
"page_drink_press",
|
||||
"page_drink_press_n",
|
||||
"page_drink_select"}
|
||||
|
||||
ALLOWED_FOLDERS = {"page_drink_n", "page_drink_press_n", "page_drink_disable_n2"}
|
||||
ALLOWED_EXTENSIONS = {".jpg", ".jpeg", ".png", ".gif", ".webp"}
|
||||
|
||||
def validate_folder(folder: str):
|
||||
|
|
|
|||
10
nginx.conf
10
nginx.conf
|
|
@ -2,13 +2,15 @@ server {
|
|||
listen 80;
|
||||
|
||||
# /image/{folder}/...
|
||||
location ~ ^/image/(page_drink_n|page_drink_press_n|page_drink_disable_n2)/(.*)$ {
|
||||
alias /taobin_project/image/$1/$2;
|
||||
location ~ ^/image/(page_drink|page_drink_disable|page_drink_disable_n|page_drink_disable_n2|page_drink_n|page_drink_picture2_n|page_drink_press|page_drink_press_n|page_drink_select)/(.*)$ {
|
||||
alias /usr/src/app/taobin_project/image/$1/$2;
|
||||
# alias /taobin_project/image/$1/$2;
|
||||
}
|
||||
|
||||
# /inter/{country}/image/{folder}/...
|
||||
location ~ ^/inter/([^/]+)/image/(page_drink_n|page_drink_press_n|page_drink_disable_n2)/(.*)$ {
|
||||
alias /taobin_project/inter/$1/image/$2/$3;
|
||||
location ~ ^/inter/([^/]+)/image/(page_drink|page_drink_disable|page_drink_disable_n|page_drink_disable_n2|page_drink_n|page_drink_picture2_n|page_drink_press|page_drink_press_n|page_drink_select)/(.*)$ {
|
||||
alias /usr/src/app/taobin_project/inter/$1/image/$2/$3;
|
||||
# alias /taobin_project/inter/$1/image/$2/$3;
|
||||
}
|
||||
|
||||
# Block any path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue