Skip to content

Commit

Permalink
fixed the build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sukruthiarjula committed Jun 13, 2024
1 parent 722e58a commit 99e57ab
Showing 1 changed file with 49 additions and 50 deletions.
99 changes: 49 additions & 50 deletions server/src/main/java/com/netflix/conductor/Conductor.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/*
* Copyright 2021-2024 DiffPlug
*
* 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.
* Copyright 2021-2024 Conductor Authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package com.netflix.conductor;

Expand All @@ -31,45 +28,47 @@
// In case that SQL database is selected this class will be imported back in the appropriate
// database persistence module.
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ComponentScan(basePackages = {
"com.netflix.conductor",
"io.orkes.conductor",
"org.ccctech.apigateway.conductor"
})
@ComponentScan(
basePackages = {
"com.netflix.conductor",
"io.orkes.conductor",
"org.ccctech.apigateway.conductor"
})
public class Conductor {

private static final Logger log = LoggerFactory.getLogger(Conductor.class);
private static final Logger log = LoggerFactory.getLogger(Conductor.class);

public static void main(String[] args) throws IOException {
loadExternalConfig();
SpringApplication.run(Conductor.class, args);
}
public static void main(String[] args) throws IOException {
loadExternalConfig();
SpringApplication.run(Conductor.class, args);
}

/**
* Reads properties from the location specified in <code>CONDUCTOR_CONFIG_FILE</code> and sets
* them as system properties so they override the default properties.
*
* <p>Spring Boot property hierarchy is documented here,
* https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config
*
* @throws IOException if file can't be read.
*/
private static void loadExternalConfig() throws IOException {
String configFile = System.getProperty("CONDUCTOR_CONFIG_FILE");
if (StringUtils.isBlank(configFile)) {
configFile = System.getenv("CONDUCTOR_CONFIG_FILE");
}
if (StringUtils.isNotBlank(configFile)) {
log.info("Loading {}", configFile);
FileSystemResource resource = new FileSystemResource(configFile);
if (resource.exists()) {
Properties properties = new Properties();
properties.load(resource.getInputStream());
properties.forEach((key, value) -> System.setProperty((String) key, (String) value));
log.info("Loaded {} properties from {}", properties.size(), configFile);
} else {
log.warn("Ignoring {} since it does not exist", configFile);
}
}
}
/**
* Reads properties from the location specified in <code>CONDUCTOR_CONFIG_FILE</code> and sets
* them as system properties so they override the default properties.
*
* <p>Spring Boot property hierarchy is documented here,
* https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config
*
* @throws IOException if file can't be read.
*/
private static void loadExternalConfig() throws IOException {
String configFile = System.getProperty("CONDUCTOR_CONFIG_FILE");
if (StringUtils.isBlank(configFile)) {
configFile = System.getenv("CONDUCTOR_CONFIG_FILE");
}
if (StringUtils.isNotBlank(configFile)) {
log.info("Loading {}", configFile);
FileSystemResource resource = new FileSystemResource(configFile);
if (resource.exists()) {
Properties properties = new Properties();
properties.load(resource.getInputStream());
properties.forEach(
(key, value) -> System.setProperty((String) key, (String) value));
log.info("Loaded {} properties from {}", properties.size(), configFile);
} else {
log.warn("Ignoring {} since it does not exist", configFile);
}
}
}
}

0 comments on commit 99e57ab

Please sign in to comment.