All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.jhipster.config.JHipsterProperties Maven / Gradle / Ivy

Go to download

Server-side library used by applications created with the JHipster generator, see https://www.jhipster.tech/ for more information on JHipster

There is a newer version: 3.9.1
Show newest version
/*
 * Copyright 2016-2018 the original author or authors from the JHipster project.
 *
 * This file is part of the JHipster project, see https://www.jhipster.tech/
 * for more information.
 *
 * 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.
 */

package io.github.jhipster.config;

import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotNull;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.web.cors.CorsConfiguration;

/**
 * Properties specific to JHipster.
 *
 * 

Properties are configured in the application.yml file.

*

This class also load properties in the Spring Environment from the git.properties and META-INF/build-info.properties * files if they are found in the classpath.

*/ @ConfigurationProperties(prefix = "jhipster", ignoreUnknownFields = false) @PropertySources({ @PropertySource(value = "classpath:git.properties", ignoreResourceNotFound = true), @PropertySource(value = "classpath:META-INF/build-info.properties", ignoreResourceNotFound = true) }) public class JHipsterProperties { private final Async async = new Async(); private final Http http = new Http(); private final Cache cache = new Cache(); private final Mail mail = new Mail(); private final Security security = new Security(); private final Swagger swagger = new Swagger(); private final Metrics metrics = new Metrics(); private final Logging logging = new Logging(); private final CorsConfiguration cors = new CorsConfiguration(); private final Social social = new Social(); private final Gateway gateway = new Gateway(); private final Registry registry = new Registry(); public Async getAsync() { return async; } public Http getHttp() { return http; } public Cache getCache() { return cache; } public Mail getMail() { return mail; } public Registry getRegistry() { return registry; } public Security getSecurity() { return security; } public Swagger getSwagger() { return swagger; } public Metrics getMetrics() { return metrics; } public Logging getLogging() { return logging; } public CorsConfiguration getCors() { return cors; } public Social getSocial() { return social; } public Gateway getGateway() { return gateway; } public static class Async { private int corePoolSize = JHipsterDefaults.Async.corePoolSize; private int maxPoolSize = JHipsterDefaults.Async.maxPoolSize; private int queueCapacity = JHipsterDefaults.Async.queueCapacity; public int getCorePoolSize() { return corePoolSize; } public void setCorePoolSize(int corePoolSize) { this.corePoolSize = corePoolSize; } public int getMaxPoolSize() { return maxPoolSize; } public void setMaxPoolSize(int maxPoolSize) { this.maxPoolSize = maxPoolSize; } public int getQueueCapacity() { return queueCapacity; } public void setQueueCapacity(int queueCapacity) { this.queueCapacity = queueCapacity; } } public static class Http { public enum Version {V_1_1, V_2_0} private final Cache cache = new Cache(); /** * Https has to be active with cipher suite define also */ private boolean useUndertowUserCipherSuitesOrder = JHipsterDefaults.Http.useUndertowUserCipherSuitesOrder; /** * HTTP version, must be "V_1_1" (for HTTP/1.1) or V_2_0 (for (HTTP/2) */ public Version version = JHipsterDefaults.Http.version; public Cache getCache() { return cache; } public Version getVersion() { return version; } public void setVersion(Version version) { this.version = version; } public static class Cache { private int timeToLiveInDays = JHipsterDefaults.Http.Cache.timeToLiveInDays; public int getTimeToLiveInDays() { return timeToLiveInDays; } public void setTimeToLiveInDays(int timeToLiveInDays) { this.timeToLiveInDays = timeToLiveInDays; } } public boolean isUseUndertowUserCipherSuitesOrder() { return useUndertowUserCipherSuitesOrder; } public void setUseUndertowUserCipherSuitesOrder(boolean useUndertowUserCipherSuitesOrder) { this.useUndertowUserCipherSuitesOrder = useUndertowUserCipherSuitesOrder; } } public static class Cache { private final Hazelcast hazelcast = new Hazelcast(); private final Ehcache ehcache = new Ehcache(); private final Infinispan infinispan = new Infinispan(); private final Memcached memcached = new Memcached(); public Hazelcast getHazelcast() { return hazelcast; } public Ehcache getEhcache() { return ehcache; } public Infinispan getInfinispan() { return infinispan; } public Memcached getMemcached() { return memcached; } public static class Hazelcast { private int timeToLiveSeconds = JHipsterDefaults.Cache.Hazelcast.timeToLiveSeconds; private int backupCount = JHipsterDefaults.Cache.Hazelcast.backupCount; private final ManagementCenter managementCenter = new ManagementCenter(); public ManagementCenter getManagementCenter() { return managementCenter; } public static class ManagementCenter { private boolean enabled = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.enabled; private int updateInterval = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.updateInterval; private String url = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.url; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public int getUpdateInterval() { return updateInterval; } public void setUpdateInterval(int updateInterval) { this.updateInterval = updateInterval; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } } public int getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(int timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public int getBackupCount() { return backupCount; } public void setBackupCount(int backupCount) { this.backupCount = backupCount; } } public static class Ehcache { private int timeToLiveSeconds = JHipsterDefaults.Cache.Ehcache.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Ehcache.maxEntries; public int getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(int timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } public static class Infinispan { private String configFile = JHipsterDefaults.Cache.Infinispan.configFile; private boolean statsEnabled = JHipsterDefaults.Cache.Infinispan.statsEnabled; private final Local local = new Local(); private final Distributed distributed = new Distributed(); private final Replicated replicated = new Replicated(); public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public boolean isStatsEnabled() { return statsEnabled; } public void setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; } public Local getLocal() { return local; } public Distributed getDistributed() { return distributed; } public Replicated getReplicated() { return replicated; } public static class Local { private long timeToLiveSeconds = JHipsterDefaults.Cache.Infinispan.Local.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Infinispan.Local.maxEntries; public long getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } public static class Distributed { private long timeToLiveSeconds = JHipsterDefaults.Cache.Infinispan.Distributed.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Infinispan.Distributed.maxEntries; private int instanceCount = JHipsterDefaults.Cache.Infinispan.Distributed.instanceCount; public long getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } public int getInstanceCount() { return instanceCount; } public void setInstanceCount(int instanceCount) { this.instanceCount = instanceCount; } } public static class Replicated { private long timeToLiveSeconds = JHipsterDefaults.Cache.Infinispan.Replicated.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Infinispan.Replicated.maxEntries; public long getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } } public static class Memcached { private boolean enabled = JHipsterDefaults.Cache.Memcached.enabled; /** * Comma or whitespace separated list of servers' addresses. */ private String servers = JHipsterDefaults.Cache.Memcached.servers; private int expiration = JHipsterDefaults.Cache.Memcached.expiration; private boolean useBinaryProtocol = JHipsterDefaults.Cache.Memcached.useBinaryProtocol; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getServers() { return servers; } public void setServers(String servers) { this.servers = servers; } public int getExpiration() { return expiration; } public void setExpiration(int expiration) { this.expiration = expiration; } public boolean isUseBinaryProtocol() { return useBinaryProtocol; } public void setUseBinaryProtocol(boolean useBinaryProtocol) { this.useBinaryProtocol = useBinaryProtocol; } } } public static class Mail { private boolean enabled = JHipsterDefaults.Mail.enabled; private String from = JHipsterDefaults.Mail.from; private String baseUrl = JHipsterDefaults.Mail.baseUrl; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getBaseUrl() { return baseUrl; } public void setBaseUrl(String baseUrl) { this.baseUrl = baseUrl; } } public static class Security { private final ClientAuthorization clientAuthorization = new ClientAuthorization(); private final Authentication authentication = new Authentication(); private final RememberMe rememberMe = new RememberMe(); public ClientAuthorization getClientAuthorization() { return clientAuthorization; } public Authentication getAuthentication() { return authentication; } public RememberMe getRememberMe() { return rememberMe; } public static class ClientAuthorization { private String accessTokenUri = JHipsterDefaults.Security.ClientAuthorization.accessTokenUri; private String tokenServiceId = JHipsterDefaults.Security.ClientAuthorization.tokenServiceId; private String clientId = JHipsterDefaults.Security.ClientAuthorization.clientId; private String clientSecret = JHipsterDefaults.Security.ClientAuthorization.clientSecret; public String getAccessTokenUri() { return accessTokenUri; } public void setAccessTokenUri(String accessTokenUri) { this.accessTokenUri = accessTokenUri; } public String getTokenServiceId() { return tokenServiceId; } public void setTokenServiceId(String tokenServiceId) { this.tokenServiceId = tokenServiceId; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } public String getClientSecret() { return clientSecret; } public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; } } public static class Authentication { private final Jwt jwt = new Jwt(); public Jwt getJwt() { return jwt; } public static class Jwt { private String secret = JHipsterDefaults.Security.Authentication.Jwt.secret; private String base64Secret = JHipsterDefaults.Security.Authentication.Jwt.base64Secret; private long tokenValidityInSeconds = JHipsterDefaults.Security.Authentication.Jwt .tokenValidityInSeconds; private long tokenValidityInSecondsForRememberMe = JHipsterDefaults.Security.Authentication.Jwt .tokenValidityInSecondsForRememberMe; public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getBase64Secret() { return base64Secret; } public void setBase64Secret(String base64Secret) { this.base64Secret = base64Secret; } public long getTokenValidityInSeconds() { return tokenValidityInSeconds; } public void setTokenValidityInSeconds(long tokenValidityInSeconds) { this.tokenValidityInSeconds = tokenValidityInSeconds; } public long getTokenValidityInSecondsForRememberMe() { return tokenValidityInSecondsForRememberMe; } public void setTokenValidityInSecondsForRememberMe(long tokenValidityInSecondsForRememberMe) { this.tokenValidityInSecondsForRememberMe = tokenValidityInSecondsForRememberMe; } } } public static class RememberMe { @NotNull private String key = JHipsterDefaults.Security.RememberMe.key; public String getKey() { return key; } public void setKey(String key) { this.key = key; } } } public static class Swagger { private String title = JHipsterDefaults.Swagger.title; private String description = JHipsterDefaults.Swagger.description; private String version = JHipsterDefaults.Swagger.version; private String termsOfServiceUrl = JHipsterDefaults.Swagger.termsOfServiceUrl; private String contactName = JHipsterDefaults.Swagger.contactName; private String contactUrl = JHipsterDefaults.Swagger.contactUrl; private String contactEmail = JHipsterDefaults.Swagger.contactEmail; private String license = JHipsterDefaults.Swagger.license; private String licenseUrl = JHipsterDefaults.Swagger.licenseUrl; private String defaultIncludePattern = JHipsterDefaults.Swagger.defaultIncludePattern; private String host = JHipsterDefaults.Swagger.host; private String[] protocols = JHipsterDefaults.Swagger.protocols; private boolean useDefaultResponseMessages = JHipsterDefaults.Swagger.useDefaultResponseMessages; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getTermsOfServiceUrl() { return termsOfServiceUrl; } public void setTermsOfServiceUrl(String termsOfServiceUrl) { this.termsOfServiceUrl = termsOfServiceUrl; } public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public String getContactUrl() { return contactUrl; } public void setContactUrl(String contactUrl) { this.contactUrl = contactUrl; } public String getContactEmail() { return contactEmail; } public void setContactEmail(String contactEmail) { this.contactEmail = contactEmail; } public String getLicense() { return license; } public void setLicense(String license) { this.license = license; } public String getLicenseUrl() { return licenseUrl; } public void setLicenseUrl(String licenseUrl) { this.licenseUrl = licenseUrl; } public String getDefaultIncludePattern() { return defaultIncludePattern; } public void setDefaultIncludePattern(String defaultIncludePattern) { this.defaultIncludePattern = defaultIncludePattern; } public String getHost() { return host; } public void setHost(final String host) { this.host = host; } public String[] getProtocols() { return protocols; } public void setProtocols(final String[] protocols) { this.protocols = protocols; } public boolean isUseDefaultResponseMessages() { return useDefaultResponseMessages; } public void setUseDefaultResponseMessages(final boolean useDefaultResponseMessages) { this.useDefaultResponseMessages = useDefaultResponseMessages; } } public static class Metrics { private final Jmx jmx = new Jmx(); private final Logs logs = new Logs(); public Jmx getJmx() { return jmx; } public Logs getLogs() { return logs; } public static class Jmx { private boolean enabled = JHipsterDefaults.Metrics.Jmx.enabled; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } } public static class Logs { private boolean enabled = JHipsterDefaults.Metrics.Logs.enabled; private long reportFrequency = JHipsterDefaults.Metrics.Logs.reportFrequency; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public long getReportFrequency() { return reportFrequency; } public void setReportFrequency(long reportFrequency) { this.reportFrequency = reportFrequency; } } } public static class Logging { private final Logstash logstash = new Logstash(); public Logstash getLogstash() { return logstash; } public static class Logstash { private boolean enabled = JHipsterDefaults.Logging.Logstash.enabled; private String host = JHipsterDefaults.Logging.Logstash.host; private int port = JHipsterDefaults.Logging.Logstash.port; private int queueSize = JHipsterDefaults.Logging.Logstash.queueSize; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public int getQueueSize() { return queueSize; } public void setQueueSize(int queueSize) { this.queueSize = queueSize; } } } public static class Social { private String redirectAfterSignIn = JHipsterDefaults.Social.redirectAfterSignIn; public String getRedirectAfterSignIn() { return redirectAfterSignIn; } public void setRedirectAfterSignIn(String redirectAfterSignIn) { this.redirectAfterSignIn = redirectAfterSignIn; } } public static class Gateway { private final RateLimiting rateLimiting = new RateLimiting(); public RateLimiting getRateLimiting() { return rateLimiting; } private Map> authorizedMicroservicesEndpoints = JHipsterDefaults.Gateway .authorizedMicroservicesEndpoints; public Map> getAuthorizedMicroservicesEndpoints() { return authorizedMicroservicesEndpoints; } public void setAuthorizedMicroservicesEndpoints(Map> authorizedMicroservicesEndpoints) { this.authorizedMicroservicesEndpoints = authorizedMicroservicesEndpoints; } public static class RateLimiting { private boolean enabled = JHipsterDefaults.Gateway.RateLimiting.enabled; private long limit = JHipsterDefaults.Gateway.RateLimiting.limit; private int durationInSeconds = JHipsterDefaults.Gateway.RateLimiting.durationInSeconds; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public long getLimit() { return this.limit; } public void setLimit(long limit) { this.limit = limit; } public int getDurationInSeconds() { return durationInSeconds; } public void setDurationInSeconds(int durationInSeconds) { this.durationInSeconds = durationInSeconds; } } } public static class Registry { private String password = JHipsterDefaults.Registry.password; public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy