Commit b01c484d authored by Tika Lestari [SLB]'s avatar Tika Lestari [SLB] Committed by Rostislav Vatolin [SLB]
Browse files

make redis ttl configurable per environment

parent 51dfff02
...@@ -22,4 +22,7 @@ config: ...@@ -22,4 +22,7 @@ config:
group: group:
data: data:
root: #{ROOT_DATA_GROUP_QUOTA}# root: #{ROOT_DATA_GROUP_QUOTA}#
domain: #{DOMAIN}# domain: #{DOMAIN}#
\ No newline at end of file redis:
ttl:
seconds: #{ENTV2_REDIS_TTL_SECONDS}#
\ No newline at end of file
...@@ -75,5 +75,7 @@ spec: ...@@ -75,5 +75,7 @@ spec:
value: {{ .Values.config.domain }} value: {{ .Values.config.domain }}
- name: root_data_group_quota - name: root_data_group_quota
value: "{{ .Values.config.quota.group.data.root }}" value: "{{ .Values.config.quota.group.data.root }}"
- name: redis_ttl_seconds
value: "{{ .Values.config.redis.ttl.seconds }}"
- name: azure_istioauth_enabled - name: azure_istioauth_enabled
value: "true" value: "true"
\ No newline at end of file
...@@ -30,3 +30,6 @@ config: ...@@ -30,3 +30,6 @@ config:
data: data:
root: 5000 root: 5000
domain: contoso.com domain: contoso.com
redis:
ttl:
seconds: 1
\ No newline at end of file
...@@ -105,6 +105,7 @@ This project uses [Lombok](https://projectlombok.org/) for code generation. You ...@@ -105,6 +105,7 @@ This project uses [Lombok](https://projectlombok.org/) for code generation. You
| `server_port` | ex `8080` | Port of the server | no | -- | | `server_port` | ex `8080` | Port of the server | no | -- |
| `service_domain_name` | ex `contoso.com` | domain name of the service | yes | -- | | `service_domain_name` | ex `contoso.com` | domain name of the service | yes | -- |
| `root_data_group_quota` | ex `5000` | Maximum number of parents a group users.data.root can have | no | -- | | `root_data_group_quota` | ex `5000` | Maximum number of parents a group users.data.root can have | no | -- |
| `redis_ttl_seconds` | ex `1` | The time to live in seconds for entitlements redis cache | no | -- |
In order to run the service locally, you will need to have defined environment variables that you can find [here](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/blob/master/tools/variables/entitlements.sh#L150). In order to run the service locally, you will need to have defined environment variables that you can find [here](https://community.opengroup.org/osdu/platform/deployment-and-operations/infra-azure-provisioning/-/blob/master/tools/variables/entitlements.sh#L150).
......
...@@ -24,21 +24,18 @@ public class CacheConfig { ...@@ -24,21 +24,18 @@ public class CacheConfig {
@Value("${redis.database}") @Value("${redis.database}")
private int redisDatabase; private int redisDatabase;
@Value("${app.redis.ttl.seconds}")
private int redisTtlSeconds;
@Value("${redisson.connection.timeout}") @Value("${redisson.connection.timeout}")
private int redissonConnectionTimeout; private int redissonConnectionTimeout;
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String applicationName; private String applicationName;
@Bean
public int getRedisTtlSeconds() {
if (System.getenv("REDIS_TTL_SECONDS") == null) return 1;
else return Integer.parseInt(System.getenv("REDIS_TTL_SECONDS"));
}
@Bean @Bean
public RedisCache<String, ParentReferences> groupCacheRedis() { public RedisCache<String, ParentReferences> groupCacheRedis() {
return new RedisCache<>(getRedisHostname(), redisPort, getRedisPassword(), getRedisTtlSeconds(), redisDatabase, String.class, return new RedisCache<>(getRedisHostname(), redisPort, getRedisPassword(), redisTtlSeconds, redisDatabase, String.class,
ParentReferences.class); ParentReferences.class);
} }
......
...@@ -45,6 +45,7 @@ app.graph.db.sslEnabled=true ...@@ -45,6 +45,7 @@ app.graph.db.sslEnabled=true
app.projectId=evd-ddl-us-services app.projectId=evd-ddl-us-services
app.domain=${service_domain_name} app.domain=${service_domain_name}
app.quota.users.data.root=${root_data_group_quota} app.quota.users.data.root=${root_data_group_quota}
app.redis.ttl.seconds=${redis_ttl_seconds}
# Cache # Cache
redis.port=6380 redis.port=6380
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment