Config readDataSources(){ Config config = kikahaConf.getConfig("server.datasources"); if ( config == null ) config = kikahaConf.getConfig("server.db.datasources"); else { log.warn( "Found deprecated 'server.datasources' configuration." ); log.warn( "Consider use 'server.db.datasources' instead." ); } return config; }
@PostConstruct public void loadHttpsConfiguration(){ httpsConfig = configuration.getConfig("server.https"); }
AuthenticationRuleMatcher createRuleMatcher() { return new AuthenticationRuleMatcher( provider, config.getConfig("server.auth"), authenticationEndpoints); } }
private Map<String, Object> readHeadersFrom( final Config staticHeaderConfig ) { final Config headers = staticHeaderConfig.getConfig( "headers" ); if ( headers != null ) return headers.toMap(); return null; } }
private Config getConfigForEndpoint( final String alias ) { Config config = this.config.getConfig("server.uworkers." + alias); if ( config == null ) config = MergeableConfig.create(); return config; } }
private void loadSerializersAndUnserializers(){ final Config webSocketConfig = config.getConfig( "server.websocket" ); final Map<String, WebSocketSession.Serializer> serializers = webSocketSerializers.stream().collect(toMap(this::extractContentType, identity(), (s1,s2) -> s2)); serializer = serializers.get( webSocketConfig.getString("default-serializer") ); if ( serializer != null ) log.debug( "Default WebSocket serializer: " + serializer.getClass().getCanonicalName() ); final Map<String, WebSocketSession.Unserializer> unserializers = webSocketUnserializers.stream().collect(toMap(this::extractContentType, identity(), (s1,s2) -> s2)); unserializer = unserializers.get( webSocketConfig.getString("default-unserializer") ); if ( unserializer != null ) log.debug( "Default WebSocket unserializer: " + unserializer.getClass().getCanonicalName() ); }
BasicAWSCredentials loadCredentialFromConfig(){ final Config config = this.config.getConfig("server.aws.iam-policy"); if ( config == null ) throw new IllegalStateException( "No IAM Policy found" ); return new BasicAWSCredentials( config.getString( "access-key-id" ), config.getString( "secret-access-key" ) ); }
@Override public Config getConfig(String path) { final Config config = fallback.getConfig(path); if ( config == null ) return null; final Map<String, String> newTags = new HashMap<>(); for ( String key : getTags().keySet() ) if ( key.startsWith( path ) ) newTags.put( key.replace( path + ".", "" ), getTags().get(key) ); return new AmazonEC2Config( ()->newTags, config ); }
BasicAWSCredentials createCredential( String name ) { final Config config = this.config.getConfig("server.aws.iam-policies." + name); if ( config == null ) throw new IllegalStateException( "No AWS Configuration available for '"+ name +"'" ); return new BasicAWSCredentials( config.getString( "access-key-id" ), config.getString( "secret-access-key" ) ); } }
void loadJvmMetrics(){ final Config config = this.config.getConfig(JVM_METRICS); for (String key : config.getKeys()) { if ( config.getBoolean( key ) ) { jvmMetrics.get(key).accept(key); } } }
@Override public void load(Undertow.Builder server, DeploymentContext context) { Config httpConfig = config.getConfig("server.http"); if ( httpConfig.getBoolean("enabled") ) loadHttpListener( httpConfig, server ); }
private Map<String, DataSource> startAndCacheConfiguredDataSources() { final Map<String, DataSource> cachedDatasources = new HashMap<>(); final Config dataSources = readDataSources(); for ( String confKey : dataSources.getKeys() ) { final Config config = dataSources.getConfig(confKey); final DataSource dataSource = defaultDataSourceFactory.newDataSource(confKey, config); cachedDatasources.put( confKey, dataSource ); } return cachedDatasources; }
private Map<String, AuthenticationMechanism> instantiateMechanismsFoundOnConfig() { final Map<String, Object> values = authConfig.getConfig("auth-mechanisms").toMap(); final Map<String, AuthenticationMechanism> mechanisms = convert( values, o->instantiate( (String)o, AuthenticationMechanism.class ) ); log.debug("Found Authentication Mechanisms: " + mechanisms); return mechanisms; }
private Map<String, IdentityManager> instantiateIdentityManagersFoundOnConfig() { final Map<String, Object> values = authConfig.getConfig("identity-managers").toMap(); final Map<String, IdentityManager> identityManagers = convert( values, o->instantiate( (String)o, IdentityManager.class ) ); log.debug( "Found Identity Managers: " + identityManagers ); return identityManagers; }
public AmazonWebServiceConfiguration configForService(String serviceAlias ){ final Config config = this.config.getConfig("server.aws." + serviceAlias); if ( config == null ) throw new IllegalStateException( "No configuration for Amazon Web Service found with name '" + serviceAlias + "'" ); final String regionName = config.getString("region", "us-west-2"); final AWSCredentialsProvider credentialProvider = credentialsProducer.getCredentialProvider(config.getString("iam-policy", serviceAlias)); return new AmazonWebServiceConfiguration( credentialProvider, Regions.fromName( regionName ) ); }
@Override public void load(Undertow.Builder server, DeploymentContext context) throws IOException { Config httpConfig = config.getConfig("server.https"); if ( httpConfig.getBoolean("enabled") ) { loadHttpsListener(httpConfig, server); deployHttpToHttps(httpConfig, context); setupHttp2( httpConfig, server ); } }
@Override public void load(Undertow.Builder server, DeploymentContext context) throws IOException { final Config staticConfig = config.getConfig("server.static"); if ( staticConfig.getBoolean("enabled") ) { deployWelcomeFile(staticConfig, context); deployDefaultStaticRouting(staticConfig, context); deployWebJarStaticRouting(staticConfig, context); } }
public AmazonWebServiceConfiguration configForService( String serviceAlias ){ final Config config = getConfig().getConfig("server.aws." + serviceAlias); if ( config == null ) throw new IllegalStateException( "No configuration for Amazon Web Service found with name '" + serviceAlias + "'" ); final String regionName = config.getString("region", getDefaultRegion() ); final AWSCredentialsProvider credentialProvider = credentialsProducer.getCredentialProvider(); return new AmazonWebServiceConfiguration( credentialProvider, Regions.fromName( regionName ), config ); }
private void setSocketOptions(final Builder builder) { Config socketOptions = undertowConfig.getConfig( "server.undertow.socket-options" ); for ( String key : socketOptions.getKeys() ) { ConfigurableOption option = getConfigOption( key, socketOptions.getObject(key) ); if ( option != null ) { log.info( " " + option.getOption() + ": " + option.getValue() ); builder.setSocketOption(option.getOption(), option.getValue()); } } } }
private void setServerOptions(final Builder builder) { Config serverOptions = undertowConfig.getConfig( "server-options" ); for ( String key : serverOptions.getKeys() ) { ConfigurableOption option = getConfigOption( key, serverOptions.getObject(key) ); if ( option != null ) { log.info( " " + option.getOption() + ": " + option.getValue() ); builder.setServerOption(option.getOption(), option.getValue()); } } }