diff --git a/.env b/.env index 4a12dd3e..3a1e8a06 100644 --- a/.env +++ b/.env @@ -5,6 +5,7 @@ TAG=dev PROFILES_ACTIVE= # Database +DATABASE_NAME=youdeyiwu DATABASE_ENDPOINT=youdeyiwu:3306 -DATABASE_USERNAME=root +DATABASE_USERNAME=youdeyiwu DATABASE_PASSWORD=123456 diff --git a/docker-compose.yml b/docker-compose.yml index d1065cfc..3f422da9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: image: "youdeyiwu:${TAG}" environment: - SPRING_PROFILES_ACTIVE=${PROFILES_ACTIVE} - - SPRING_DATASOURCE_URL=jdbc:mysql://${DATABASE_ENDPOINT}/youdeyiwu?createDatabaseIfNotExist=true&serverTimezone=UTC&allowMultiQueries=true + - SPRING_DATASOURCE_URL=jdbc:mysql://${DATABASE_ENDPOINT}/${DATABASE_NAME}?createDatabaseIfNotExist=true&serverTimezone=UTC&allowMultiQueries=true - SPRING_DATASOURCE_USERNAME=${DATABASE_USERNAME} - SPRING_DATASOURCE_PASSWORD=${DATABASE_PASSWORD} build: diff --git a/hosting/.env b/hosting/.env index 43a1c75c..f978be2c 100644 --- a/hosting/.env +++ b/hosting/.env @@ -5,7 +5,8 @@ TAG=dev PROFILES_ACTIVE= # Database -DATABASE_USERNAME=root +DATABASE_NAME=youdeyiwu +DATABASE_USERNAME=youdeyiwu DATABASE_PASSWORD=123456 # Application url @@ -17,15 +18,9 @@ NAME=Youdeyiwu # Application description DESCRIPTION=Youdeyiwu is an open-source lightweight forum -# Interface address -API_SERVER=http://localhost:8080 - # Is it an HTTPS site IS_HTTPS_SITE=false -# Allowed source domain(s) for sending requests, multiple domains separated by commas -SERVER_ACTIONS_ALLOWED_ORIGINS= - # Set the remotePatterns to allow images, in the format of an array # IMAGES_REMOTE_PATTERNS_0_PROTOCOL=https # IMAGES_REMOTE_PATTERNS_0_HOSTNAME=example.com diff --git a/hosting/docker-compose.yml b/hosting/docker-compose.yml index e93e3d42..62559a9c 100644 --- a/hosting/docker-compose.yml +++ b/hosting/docker-compose.yml @@ -9,6 +9,7 @@ services: environment: - TAG - PROFILES_ACTIVE + - DATABASE_NAME - DATABASE_ENDPOINT=youdeyiwu:3306 - DATABASE_USERNAME - DATABASE_PASSWORD @@ -35,7 +36,7 @@ services: - DESCRIPTION - API_SERVER=http://youdeyiwu:8080 - IS_HTTPS_SITE - - SERVER_ACTIONS_ALLOWED_ORIGINS + - SERVER_ACTIONS_ALLOWED_ORIGINS=youdeyiwu:8080 - SHOW_FOOTER - IMAGES_REMOTE_PATTERNS_0_PROTOCOL - IMAGES_REMOTE_PATTERNS_0_HOSTNAME @@ -59,7 +60,9 @@ services: volumes: - db:/var/lib/mysql environment: - - MYSQL_ROOT_PASSWORD=123456 + - MYSQL_DATABASE=${DATABASE_NAME} + - MYSQL_USER=${DATABASE_USERNAME} + - MYSQL_PASSWORD=${DATABASE_PASSWORD} ports: - '3306:3306' networks: @@ -70,7 +73,7 @@ networks: name: youdeyiwu volumes: - logs: - name: youdeyiwu_logs db: name: youdeyiwu_db + logs: + name: youdeyiwu_logs diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 829cc4f4..b0bcbedd 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -23,7 +23,7 @@ spring.docker.compose.enabled = false # datasource spring.datasource.url = jdbc:mysql://youdeyiwu:3306/youdeyiwu?createDatabaseIfNotExist=true&serverTimezone=UTC&allowMultiQueries=true -spring.datasource.username = root +spring.datasource.username = youdeyiwu spring.datasource.password = 123456 spring.datasource.type = com.zaxxer.hikari.HikariDataSource spring.datasource.hikari.pool-name = DatebookHikariCP