Skip to content
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
4 changes: 0 additions & 4 deletions .env

This file was deleted.

15 changes: 13 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ jobs:
pip install -r requirements.txt

- name: Check FastAPI Server
env:
ALGORITHM: ${{ secrets.ALGORITHM }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
FERNET_SECRET_KEY: ${{ secrets.FERNET_SECRET_KEY }}
KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_PATH: ${{ secrets.REMOTE_PATH }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
SENDER_PASSWORD: ${{ secrets.SENDER_PASSWORD }}
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}
SQLALCHEMY_DATABASE_URL: ${{ secrets.SQLALCHEMY_DATABASE_URL }}
run: |
uvicorn app.main:app --host 0.0.0.0 --port 8000 --log-level warning &
sleep 5
curl -f http://localhost:8000/docs
sleep 5
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
env
__pycache__
articles
app.log
app.log
.env
1 change: 0 additions & 1 deletion alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ version_path_separator = os
# are written from script.py.mako
# output_encoding = utf-8

sqlalchemy.url = mysql+pymysql://root:oneapi@47.93.172.156:3306/JieNote


[post_write_hooks]
Expand Down
7 changes: 6 additions & 1 deletion alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
import os
from dotenv import load_dotenv

# 加载.env文件
load_dotenv()
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)

sqlalchemy_url = os.environ.get("DATABASE_URL")
config.set_main_option("sqlalchemy.url", sqlalchemy_url)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
Expand Down
6 changes: 3 additions & 3 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
class Settings:
PROJECT_NAME: str = "JieNote Backend" # 项目名称
VERSION: str = "1.0.0" # 项目版本
SQLALCHEMY_DATABASE_URL = "mysql+asyncmy://root:oneapi@47.93.172.156:3306/JieNote" # 替换为实际的用户名、密码和数据库名称
SQLALCHEMY_DATABASE_URL = os.getenv("SQLALCHEMY_DATABASE_URL", "default") # 替换为实际的用户名、密码和数据库名称
SECRET_KEY: str = os.getenv("SECRET_KEY", "default_secret_key") # JWT密钥
ALGORITHM: str = "HS256" # JWT算法
ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440 # token过期时间
ALGORITHM: str = os.getenv("ALGORITHM", "default") # JWT算法
ACCESS_TOKEN_EXPIRE_MINUTES: int = 5 # token过期时间
REFRESH_TOKEN_EXPIRE_DAYS: int = 7 # 刷新token过期时间7天
SMTP_SERVER: str = "smtp.163.com" # SMTP服务器
SMTP_PORT: int = 465 # SMTP端口
Expand Down
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from fastapi.staticfiles import StaticFiles
import os

app = FastAPI()
app = FastAPI(docs_url=None, redoc_url=None)

@app.get("/")
def read_root():
Expand Down