* ONAP : Data Extraction Service
* ================================================================================
* Copyright 2020 China Mobile
+* Copyright (C) 2021 Wipro Limited
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.datalake.des;
+import javax.sql.DataSource;
+
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
SpringApplication.run(DesApplication.class, args);
}
+ @Bean
+ public DataSource dataSource() {
+
+ String url = "jdbc:postgresql://" + System.getenv("PG_HOST").trim() + ":" + System.getenv("PG_PORT").trim() + "/datalake";
+ return DataSourceBuilder.create().url(url).username(System.getenv("PG_USER").trim())
+ .password(System.getenv("PG_PASSWORD").trim()).build();
+ }
+
}