2 * ============LICENSE_START=======================================================
3 * ONAP : Data Extraction Service
4 * ================================================================================
5 * Copyright 2020 China Mobile
6 * Copyright (C) 2021 Wipro Limited
7 *=================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.datalake.des;
24 import javax.sql.DataSource;
26 import org.springframework.boot.SpringApplication;
27 import org.springframework.boot.autoconfigure.SpringBootApplication;
28 import org.springframework.boot.jdbc.DataSourceBuilder;
29 import org.springframework.context.annotation.Bean;
31 import springfox.documentation.swagger2.annotations.EnableSwagger2;
34 * Entry point of the Data Extraction Service application.
40 @SpringBootApplication(scanBasePackages = { "org.onap.datalake.*" })
42 public class DesApplication {
44 public static void main(String[] args) {
45 SpringApplication.run(DesApplication.class, args);
49 public DataSource dataSource() {
51 String url = "jdbc:postgresql://" + System.getenv("PG_HOST").trim() + ":" + System.getenv("PG_PORT").trim() + "/datalake";
52 return DataSourceBuilder.create().url(url).username(System.getenv("PG_USER").trim())
53 .password(System.getenv("PG_PASSWORD").trim()).build();