Moving the dev test and build to port 5442 from 5432 to avoid conflicting with the running postgresql
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package ovh.herisson.Clyde;
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Profile;
|
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
|
@Configuration
|
|
@EnableScheduling
|
|
public class JdbcConfig {
|
|
|
|
@Bean
|
|
@Profile("!prod")
|
|
public DataSource psqlSource(){
|
|
DriverManagerDataSource source = new DriverManagerDataSource();
|
|
source.setDriverClassName("org.postgresql.Driver");
|
|
source.setUrl("jdbc:postgresql://localhost:5442/clyde");
|
|
source.setUsername("devel");
|
|
source.setPassword("devel");
|
|
|
|
return source;
|
|
}
|
|
|
|
@Bean
|
|
@Profile("prod")
|
|
public DataSource psqlSourceProd(){
|
|
DriverManagerDataSource source = new DriverManagerDataSource();
|
|
source.setDriverClassName("org.postgresql.Driver");
|
|
source.setUrl("jdbc:postgresql:clyde?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432");
|
|
source.setUsername("clyde");
|
|
|
|
return source;
|
|
}
|
|
}
|