Skip to content

Commit 74b994a

Browse files
Remote config: Use rotating store verticle and map to POJO (#1641)
- Periodically retrieve runtime config using a rotating store verticle, as core endpoint now requires attestation - Update runtime config format to include an incrementing version number, as required by rotating store verticle - Map runtime config JSON to POJO (`RuntimeConfig`) - Validate runtime config value in `RuntimeConfig` constructor so consumers don't have to remember to call `isValid` - Use builder pattern for runtime config. Makes tests cleaner. Can be replaced with Lombok in the future - Log runtime config on retrieval to help with debugging Tested scenarios: - Run locally with feature flag OFF - Operator loads runtime config values from bootstrap config - Run locally with feature flag ON, `storage_mock: false` and `runtime_config_metadata_path` pointing to core - Operator loads runtime config values from core API endpoint - Run locally with feature flag ON, `storage_mock: true` and `runtime_config_metadata_path` pointing to new `metadata.json` file - Operator loads runtime config values from local `metadata.json` file --------- Co-authored-by: Matt Collins <matt.collins@thetradedesk.com>
1 parent 291d098 commit 74b994a

27 files changed

+762
-554
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ COPY ./target/${JAR_NAME}-${JAR_VERSION}-sources.jar /app
1717
COPY ./target/${JAR_NAME}-${JAR_VERSION}-static.tar.gz /app/static.tar.gz
1818
COPY ./conf/default-config.json /app/conf/
1919
COPY ./conf/*.xml /app/conf/
20-
COPY ./conf/runtime-config-defaults.json /app/conf/
2120

2221
RUN tar xzvf /app/static.tar.gz --no-same-owner --no-same-permissions && rm -f /app/static.tar.gz
2322

conf/docker-config.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"services_metadata_path": "/com.uid2.core/test/services/metadata.json",
3333
"service_links_metadata_path": "/com.uid2.core/test/service_links/metadata.json",
3434
"cloud_encryption_keys_metadata_path": "/com.uid2.core/test/cloud_encryption_keys/metadata.json",
35+
"runtime_config_metadata_path": "/com.uid2.core/test/runtime_config/metadata.json",
3536
"encrypted_files": true,
3637
"identity_token_expires_after_seconds": 3600,
3738
"optout_metadata_path": null,
@@ -40,14 +41,6 @@
4041
"failure_shutdown_wait_hours": 120,
4142
"salts_expired_shutdown_hours": 12,
4243
"operator_type": "public",
43-
"runtime_config_store": {
44-
"type": "file",
45-
"config" : {
46-
"path": "conf/runtime-config-defaults.json",
47-
"format": "json"
48-
},
49-
"config_scan_period_ms": 5000
50-
},
5144
"disable_optout_token": true,
5245
"enable_remote_config": false
5346
}

conf/integ-config.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@
1414
"optout_api_token": "test-operator-key",
1515
"optout_api_uri": "http://localhost:8081/optout/replicate",
1616
"cloud_encryption_keys_metadata_path": "http://localhost:8088/cloud_encryption_keys/retrieve",
17+
"runtime_config_metadata_path": "http://localhost:8088/operator/config",
1718
"salts_expired_shutdown_hours": 12,
1819
"operator_type": "public",
19-
"runtime_config_store": {
20-
"type": "http",
21-
"config" : {
22-
"url": "http://localhost:8088/operator/config"
23-
},
24-
"config_scan_period_ms": 300000
25-
},
2620
"disable_optout_token": true,
2721
"enable_remote_config": false
2822
}

conf/local-config.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"services_metadata_path": "/com.uid2.core/test/services/metadata.json",
1111
"service_links_metadata_path": "/com.uid2.core/test/service_links/metadata.json",
1212
"cloud_encryption_keys_metadata_path": "/com.uid2.core/test/cloud_encryption_keys/metadata.json",
13+
"runtime_config_metadata_path": "/com.uid2.core/test/runtime_config/metadata.json",
1314
"identity_token_expires_after_seconds": 3600,
1415
"refresh_token_expires_after_seconds": 86400,
1516
"refresh_identity_token_after_seconds": 900,
@@ -39,14 +40,6 @@
3940
"salts_expired_shutdown_hours": 12,
4041
"operator_type": "public",
4142
"encrypted_files": true,
42-
"runtime_config_store": {
43-
"type": "file",
44-
"config" : {
45-
"path": "conf/runtime-config-defaults.json",
46-
"format": "json"
47-
},
48-
"config_scan_period_ms": 5000
49-
},
5043
"disable_optout_token": true,
5144
"enable_remote_config": false
5245
}

conf/local-e2e-docker-private-config.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"keyset_keys_metadata_path": "http://core:8088/key/keyset-keys/refresh",
1313
"salts_metadata_path": "http://core:8088/salt/refresh",
1414
"cloud_encryption_keys_metadata_path": "http://core:8088/cloud_encryption_keys/retrieve",
15+
"runtime_config_metadata_path": "http://core:8088/operator/config",
1516
"encrypted_files": false,
1617
"identity_token_expires_after_seconds": 3600,
1718
"refresh_token_expires_after_seconds": 86400,
@@ -30,12 +31,5 @@
3031
"cloud_refresh_interval": 30,
3132
"salts_expired_shutdown_hours": 12,
3233
"operator_type": "private",
33-
"runtime_config_store": {
34-
"type": "http",
35-
"config" : {
36-
"url": "http://core:8088/operator/config"
37-
},
38-
"config_scan_period_ms": 300000
39-
},
4034
"enable_remote_config": false
4135
}

conf/local-e2e-docker-public-config.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"services_metadata_path": "http://core:8088/services/refresh",
1515
"service_links_metadata_path": "http://core:8088/service_links/refresh",
1616
"cloud_encryption_keys_metadata_path": "http://core:8088/cloud_encryption_keys/retrieve",
17+
"runtime_config_metadata_path": "http://core:8088/operator/config",
1718
"encrypted_files": false,
1819
"identity_token_expires_after_seconds": 3600,
1920
"refresh_token_expires_after_seconds": 86400,
@@ -36,13 +37,6 @@
3637
"cloud_refresh_interval": 30,
3738
"salts_expired_shutdown_hours": 12,
3839
"operator_type": "public",
39-
"runtime_config_store": {
40-
"type": "http",
41-
"config" : {
42-
"url": "http://core:8088/operator/config"
43-
},
44-
"config_scan_period_ms": 300000
45-
},
4640
"disable_optout_token": true,
4741
"enable_remote_config": false
4842
}

conf/local-e2e-private-config.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"services_metadata_path": "http://localhost:8088/services/refresh",
1515
"service_links_metadata_path": "http://localhost:8088/service_links/refresh",
1616
"cloud_encryption_keys_metadata_path": "http://localhost:8088/cloud_encryption_keys/retrieve",
17+
"runtime_config_metadata_path": "http://localhost:8088/operator/config",
1718
"encrypted_files": false,
1819
"identity_token_expires_after_seconds": 3600,
1920
"refresh_token_expires_after_seconds": 86400,
@@ -41,12 +42,5 @@
4142
"client_side_token_generate_log_invalid_http_origins": true,
4243
"salts_expired_shutdown_hours": 12,
4344
"operator_type": "private",
44-
"runtime_config_store": {
45-
"type": "http",
46-
"config" : {
47-
"url": "http://localhost:8088/operator/config"
48-
},
49-
"config_scan_period_ms": 300000
50-
},
5145
"enable_remote_config": false
5246
}

conf/local-e2e-public-config.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"services_metadata_path": "http://localhost:8088/services/refresh",
1515
"service_links_metadata_path": "http://localhost:8088/service_links/refresh",
1616
"cloud_encryption_keys_metadata_path": "http://localhost:8088/cloud_encryption_keys/retrieve",
17+
"runtime_config_metadata_path": "http://localhost:8088/operator/config",
1718
"encrypted_files": false,
1819
"identity_token_expires_after_seconds": 3600,
1920
"refresh_token_expires_after_seconds": 86400,
@@ -42,13 +43,6 @@
4243
"client_side_token_generate_log_invalid_http_origins": true,
4344
"salts_expired_shutdown_hours": 12,
4445
"operator_type": "public",
45-
"runtime_config_store": {
46-
"type": "http",
47-
"config" : {
48-
"url": "http://localhost:8088/operator/config"
49-
},
50-
"config_scan_period_ms": 300000
51-
},
5246
"disable_optout_token": true,
5347
"enable_remote_config": false
5448
}

conf/runtime-config-defaults.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/main/java/com/uid2/operator/Const.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ public class Config extends com.uid2.shared.Const.Config {
3535
public static final String IdentityV3Prop = "identity_v3";
3636
public static final String DisableOptoutTokenProp = "disable_optout_token";
3737
public static final String EnableRemoteConfigProp = "enable_remote_config";
38+
public static final String RuntimeConfigMetadataPathProp = "runtime_config_metadata_path";
3839
}
3940
}

0 commit comments

Comments
 (0)