From 9df198fb1b9b0622864327ff822861f6ff5ee699 Mon Sep 17 00:00:00 2001 From: ZhangJian He Date: Sat, 4 Mar 2023 15:14:56 +0800 Subject: [PATCH] [Multi-Database Support] Introduce h2 postgre profile properties to let user config database config --- CHANGES.md | 3 ++- .../resources/application-github.properties | 1 - .../src/main/resources/application.properties | 3 +++ .../src/main/resources/application.properties | 24 +++++++++++++++++++ .../main/resources/application-h2.properties | 15 ++++++++++++ .../resources/application-mysql.properties | 16 +++++++++++++ .../resources/application-postgre.properties | 15 ++++++++++++ .../resources/application-github.properties | 1 - .../src/main/resources/application.properties | 3 +++ .../resources/application-github.properties | 1 - .../src/main/resources/application.properties | 24 +++++++++++++++++++ 11 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 apollo-assembly/src/main/resources/application.properties create mode 100644 apollo-common/src/main/resources/application-h2.properties create mode 100644 apollo-common/src/main/resources/application-mysql.properties create mode 100644 apollo-common/src/main/resources/application-postgre.properties create mode 100644 apollo-portal/src/main/resources/application.properties diff --git a/CHANGES.md b/CHANGES.md index eec661b1079..7d73c4e592c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,9 +11,10 @@ Apollo 2.2.0 * [Bump springboot version from 2.7.8 to 2.7.9](https://github.com/apolloconfig/apollo/pull/4750) * [[Multi-Database Support] Without Reliance on globally_quoted_identifiers Variable](https://github.com/apolloconfig/apollo/pull/4749) * [[Multi-Database Support] Without Reliance on boolean integer compare](https://github.com/apolloconfig/apollo/pull/4757) -* [[Multi-Database Support] package postgre h2 dependency](https://github.com/apolloconfig/apollo/pull/4757) +* [[Multi-Database Support] package postgre h2 dependency](https://github.com/apolloconfig/apollo/pull/4763) * [[Multi-Database Support] Optimize table case](https://github.com/apolloconfig/apollo/pull/4768) * [Fix OIDC logout unnecessary redirect](https://github.com/apolloconfig/apollo/pull/4773) +* [[Multi-Database Support] Introduce h2 postgre profile properties to let user config database config](https://github.com/apolloconfig/apollo/pull/4766) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/13?closed=1) \ No newline at end of file diff --git a/apollo-adminservice/src/main/resources/application-github.properties b/apollo-adminservice/src/main/resources/application-github.properties index 4f4e34d881c..3312cef3cb0 100644 --- a/apollo-adminservice/src/main/resources/application-github.properties +++ b/apollo-adminservice/src/main/resources/application-github.properties @@ -14,7 +14,6 @@ # limitations under the License. # # DataSource -spring.datasource.hikari.connection-init-sql = SET NAMES utf8mb4 spring.datasource.url = ${spring_datasource_url} spring.datasource.username = ${spring_datasource_username} spring.datasource.password = ${spring_datasource_password} diff --git a/apollo-adminservice/src/main/resources/application.properties b/apollo-adminservice/src/main/resources/application.properties index 7f508726898..5ede28e5782 100644 --- a/apollo-adminservice/src/main/resources/application.properties +++ b/apollo-adminservice/src/main/resources/application.properties @@ -19,3 +19,6 @@ #spring.profiles.active=github,zookeeper-discovery #spring.profiles.active=github,custom-defined-discovery #spring.profiles.active=github,database-discovery + +# You may change the following config to activate different database profiles like h2/postgres +spring.profiles.group.github = mysql diff --git a/apollo-assembly/src/main/resources/application.properties b/apollo-assembly/src/main/resources/application.properties new file mode 100644 index 00000000000..5ede28e5782 --- /dev/null +++ b/apollo-assembly/src/main/resources/application.properties @@ -0,0 +1,24 @@ +# +# Copyright 2023 Apollo Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# You may uncomment the following config to activate different spring profiles +#spring.profiles.active=github,consul-discovery +#spring.profiles.active=github,zookeeper-discovery +#spring.profiles.active=github,custom-defined-discovery +#spring.profiles.active=github,database-discovery + +# You may change the following config to activate different database profiles like h2/postgres +spring.profiles.group.github = mysql diff --git a/apollo-common/src/main/resources/application-h2.properties b/apollo-common/src/main/resources/application-h2.properties new file mode 100644 index 00000000000..fe31a3d66b8 --- /dev/null +++ b/apollo-common/src/main/resources/application-h2.properties @@ -0,0 +1,15 @@ +# +# Copyright 2023 Apollo Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/apollo-common/src/main/resources/application-mysql.properties b/apollo-common/src/main/resources/application-mysql.properties new file mode 100644 index 00000000000..1ca0a3abb67 --- /dev/null +++ b/apollo-common/src/main/resources/application-mysql.properties @@ -0,0 +1,16 @@ +# +# Copyright 2023 Apollo Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +spring.datasource.hikari.connection-init-sql = SET NAMES utf8mb4 diff --git a/apollo-common/src/main/resources/application-postgre.properties b/apollo-common/src/main/resources/application-postgre.properties new file mode 100644 index 00000000000..fe31a3d66b8 --- /dev/null +++ b/apollo-common/src/main/resources/application-postgre.properties @@ -0,0 +1,15 @@ +# +# Copyright 2023 Apollo Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/apollo-configservice/src/main/resources/application-github.properties b/apollo-configservice/src/main/resources/application-github.properties index 4f4e34d881c..3312cef3cb0 100644 --- a/apollo-configservice/src/main/resources/application-github.properties +++ b/apollo-configservice/src/main/resources/application-github.properties @@ -14,7 +14,6 @@ # limitations under the License. # # DataSource -spring.datasource.hikari.connection-init-sql = SET NAMES utf8mb4 spring.datasource.url = ${spring_datasource_url} spring.datasource.username = ${spring_datasource_username} spring.datasource.password = ${spring_datasource_password} diff --git a/apollo-configservice/src/main/resources/application.properties b/apollo-configservice/src/main/resources/application.properties index 7f508726898..5ede28e5782 100644 --- a/apollo-configservice/src/main/resources/application.properties +++ b/apollo-configservice/src/main/resources/application.properties @@ -19,3 +19,6 @@ #spring.profiles.active=github,zookeeper-discovery #spring.profiles.active=github,custom-defined-discovery #spring.profiles.active=github,database-discovery + +# You may change the following config to activate different database profiles like h2/postgres +spring.profiles.group.github = mysql diff --git a/apollo-portal/src/main/resources/application-github.properties b/apollo-portal/src/main/resources/application-github.properties index 4f4e34d881c..3312cef3cb0 100644 --- a/apollo-portal/src/main/resources/application-github.properties +++ b/apollo-portal/src/main/resources/application-github.properties @@ -14,7 +14,6 @@ # limitations under the License. # # DataSource -spring.datasource.hikari.connection-init-sql = SET NAMES utf8mb4 spring.datasource.url = ${spring_datasource_url} spring.datasource.username = ${spring_datasource_username} spring.datasource.password = ${spring_datasource_password} diff --git a/apollo-portal/src/main/resources/application.properties b/apollo-portal/src/main/resources/application.properties new file mode 100644 index 00000000000..5ede28e5782 --- /dev/null +++ b/apollo-portal/src/main/resources/application.properties @@ -0,0 +1,24 @@ +# +# Copyright 2023 Apollo Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# You may uncomment the following config to activate different spring profiles +#spring.profiles.active=github,consul-discovery +#spring.profiles.active=github,zookeeper-discovery +#spring.profiles.active=github,custom-defined-discovery +#spring.profiles.active=github,database-discovery + +# You may change the following config to activate different database profiles like h2/postgres +spring.profiles.group.github = mysql