database on deploy
This commit is contained in:
parent
9c92e7d1e9
commit
43adb6d31f
@ -5,5 +5,6 @@ services:
|
|||||||
- 'POSTGRES_DB=clyde'
|
- 'POSTGRES_DB=clyde'
|
||||||
- 'POSTGRES_USER=devel'
|
- 'POSTGRES_USER=devel'
|
||||||
- 'POSTGRES_PASSWORD=devel'
|
- 'POSTGRES_PASSWORD=devel'
|
||||||
|
- 'SPRING_PROFILES_ACTIVE=prod'
|
||||||
ports:
|
ports:
|
||||||
- '5432:5432'
|
- '5432:5432'
|
||||||
|
@ -4,6 +4,7 @@ import javax.sql.DataSource;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
@ -12,6 +13,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
public class JdbcConfig {
|
public class JdbcConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@Profile("!prod")
|
||||||
public DataSource psqlSource(){
|
public DataSource psqlSource(){
|
||||||
DriverManagerDataSource source = new DriverManagerDataSource();
|
DriverManagerDataSource source = new DriverManagerDataSource();
|
||||||
source.setDriverClassName("org.postgresql.Driver");
|
source.setDriverClassName("org.postgresql.Driver");
|
||||||
@ -22,6 +24,17 @@ public class JdbcConfig {
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Profile("prod")
|
||||||
|
public DataSource psqlSourceProd(){
|
||||||
|
DriverManagerDataSource source = new DriverManagerDataSource();
|
||||||
|
source.setDriverClassName("org.postgresql.Driver");
|
||||||
|
source.setUrl("jdbc:postgresql://localhost:5432/clyde");
|
||||||
|
source.setUsername("clyde");
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public WebMvcConfigurer corsConfigurer() {
|
public WebMvcConfigurer corsConfigurer() {
|
||||||
|
Loading…
Reference in New Issue
Block a user