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:
group:
data:
root: #{ROOT_DATA_GROUP_QUOTA}#
domain: #{DOMAIN}#
\ No newline at end of file
domain: #{DOMAIN}#
redis:
ttl:
seconds: #{ENTV2_REDIS_TTL_SECONDS}#
\ No newline at end of file
......@@ -75,5 +75,7 @@ spec:
value: {{ .Values.config.domain }}
- name: root_data_group_quota
value: "{{ .Values.config.quota.group.data.root }}"
- name: redis_ttl_seconds
value: "{{ .Values.config.redis.ttl.seconds }}"
- name: azure_istioauth_enabled
value: "true"
\ No newline at end of file
......@@ -30,3 +30,6 @@ config:
data:
root: 5000
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
| `server_port` | ex `8080` | Port of the server | no | -- |
| `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 | -- |
| `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).
......
......@@ -24,21 +24,18 @@ public class CacheConfig {
@Value("${redis.database}")
private int redisDatabase;
@Value("${app.redis.ttl.seconds}")
private int redisTtlSeconds;
@Value("${redisson.connection.timeout}")
private int redissonConnectionTimeout;
@Value("${spring.application.name}")
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
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);
}
......
......@@ -45,6 +45,7 @@ app.graph.db.sslEnabled=true
app.projectId=evd-ddl-us-services
app.domain=${service_domain_name}
app.quota.users.data.root=${root_data_group_quota}
app.redis.ttl.seconds=${redis_ttl_seconds}
# Cache
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