Skip to content

Commit e31eeb3

Browse files
committed
RANGER-5103: RangerPluginConfig to support initialization with additional config files (#510)
1 parent 852a26b commit e31eeb3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerPluginConfig.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.Collection;
3333
import java.util.Collections;
3434
import java.util.HashSet;
35+
import java.util.List;
3536
import java.util.Set;
3637

3738
public class RangerPluginConfig extends RangerConfiguration {
@@ -62,6 +63,10 @@ public class RangerPluginConfig extends RangerConfiguration {
6263
private Set<String> serviceAdmins = Collections.emptySet();
6364

6465
public RangerPluginConfig(String serviceType, String serviceName, String appId, String clusterName, String clusterType, RangerPolicyEngineOptions policyEngineOptions) {
66+
this(serviceType, serviceName, appId, clusterName, clusterType, null, policyEngineOptions);
67+
}
68+
69+
public RangerPluginConfig(String serviceType, String serviceName, String appId, String clusterName, String clusterType, List<File> additionalConfigFiles, RangerPolicyEngineOptions policyEngineOptions) {
6570
super();
6671

6772
addResourcesForServiceType(serviceType);
@@ -73,6 +78,16 @@ public RangerPluginConfig(String serviceType, String serviceName, String appId,
7378

7479
addResourcesForServiceName(this.serviceType, this.serviceName);
7580

81+
if (additionalConfigFiles != null) {
82+
for (File configFile : additionalConfigFiles) {
83+
try {
84+
addResource(configFile.toURI().toURL());
85+
} catch (Throwable t) {
86+
LOG.warn("failed to load configurations from {}", configFile, t);
87+
}
88+
}
89+
}
90+
7691
String trustedProxyAddressString = this.get(propertyPrefix + ".trusted.proxy.ipaddresses");
7792

7893
if (StringUtil.isEmpty(clusterName)) {

0 commit comments

Comments
 (0)