瀏覽代碼

Feat/optimize install wildcard support (#53)

tags/0.2.2
John Wang 2 年之前
父節點
當前提交
8847bb1e45
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 24 行新增20 行删除
  1. 3
    3
      api/models/model.py
  2. 20
    16
      docker/docker-compose.yaml
  3. 1
    1
      docker/nginx/conf.d/default.conf

+ 3
- 3
api/models/model.py 查看文件

import json import json


from flask import current_app
from flask import current_app, request
from flask_login import UserMixin from flask_login import UserMixin
from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.dialects.postgresql import UUID




@property @property
def api_base_url(self): def api_base_url(self):
return current_app.config['API_URL'] + '/v1'
return (current_app.config['API_URL'] if current_app.config['API_URL'] else request.host_url.rstrip('/')) + '/v1'


@property @property
def tenant(self): def tenant(self):


@property @property
def app_base_url(self): def app_base_url(self):
return current_app.config['APP_URL']
return (current_app.config['APP_URL'] if current_app.config['APP_URL'] else request.host_url.rstrip('/')) + '/v1'




class ApiToken(db.Model): class ApiToken(db.Model):

+ 20
- 16
docker/docker-compose.yaml 查看文件

LOG_LEVEL: INFO LOG_LEVEL: INFO
# A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`. # A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
# The base URL of console application, refers to the Console base URL of WEB service.
CONSOLE_URL: http://localhost
# The URL for Service API endpoints,refers to the base URL of the current API service.
API_URL: http://localhost
# The URL for Web APP, refers to the Web App base URL of WEB service.
APP_URL: http://localhost
# The base URL of console application, refers to the Console base URL of WEB service if console domain is
# different from api or web app domain.
# example: http://cloud.dify.ai
CONSOLE_URL: ''
# The URL for Service API endpoints,refers to the base URL of the current API service if api domain is
# different from console domain.
# example: http://api.dify.ai
API_URL: ''
# The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
# console or api domain.
# example: http://udify.app
APP_URL: ''
# When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed. # When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
MIGRATION_ENABLED: 'true' MIGRATION_ENABLED: 'true'
# The configurations of postgres database connection. # The configurations of postgres database connection.
# A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`. # A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
# same as the API service # same as the API service
SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
# The base URL of console application, refers to the Console base URL of WEB service.
CONSOLE_URL: http://localhost
# The URL for Service API endpoints,refers to the base URL of the current API service.
API_URL: http://localhost
# The URL for Web APP, refers to the Web App base URL of WEB service.
APP_URL: http://localhost
# The configurations of postgres database connection. # The configurations of postgres database connection.
# It is consistent with the configuration in the 'db' service below. # It is consistent with the configuration in the 'db' service below.
DB_USERNAME: postgres DB_USERNAME: postgres
restart: always restart: always
environment: environment:
EDITION: SELF_HOSTED EDITION: SELF_HOSTED
# The base URL of console application, refers to the Console base URL of WEB service.
CONSOLE_URL: http://localhost
# The URL for Web APP, refers to the Web App base URL of WEB service.
APP_URL: http://localhost
# The base URL of console application, refers to the Console base URL of WEB service if console domain is
# different from api or web app domain.
# example: http://cloud.dify.ai
CONSOLE_URL: ''
# The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
# console or api domain.
# example: http://udify.app
APP_URL: ''


# The postgres database. # The postgres database.
db: db:

+ 1
- 1
docker/nginx/conf.d/default.conf 查看文件

server { server {
listen 80; listen 80;
server_name localhost;
server_name _;


location /console/api { location /console/api {
proxy_pass http://api:5001; proxy_pass http://api:5001;

Loading…
取消
儲存