Unverified Commit 8847bb1e authored by John Wang's avatar John Wang Committed by GitHub

Feat/optimize install wildcard support (#53)

parent 5fcd5c24
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
...@@ -56,7 +56,7 @@ class App(db.Model): ...@@ -56,7 +56,7 @@ class App(db.Model):
@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):
...@@ -505,7 +505,7 @@ class Site(db.Model): ...@@ -505,7 +505,7 @@ class Site(db.Model):
@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):
......
...@@ -11,12 +11,18 @@ services: ...@@ -11,12 +11,18 @@ services:
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. # The base URL of console application, refers to the Console base URL of WEB service if console domain is
CONSOLE_URL: http://localhost # different from api or web app domain.
# The URL for Service API endpoints,refers to the base URL of the current API service. # example: http://cloud.dify.ai
API_URL: http://localhost CONSOLE_URL: ''
# The URL for Web APP, refers to the Web App base URL of WEB service. # The URL for Service API endpoints,refers to the base URL of the current API service if api domain is
APP_URL: http://localhost # 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.
...@@ -113,12 +119,6 @@ services: ...@@ -113,12 +119,6 @@ services:
# 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
...@@ -154,10 +154,14 @@ services: ...@@ -154,10 +154,14 @@ services:
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. # The base URL of console application, refers to the Console base URL of WEB service if console domain is
CONSOLE_URL: http://localhost # different from api or web app domain.
# The URL for Web APP, refers to the Web App base URL of WEB service. # example: http://cloud.dify.ai
APP_URL: http://localhost 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:
......
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment