2323 */
2424package com .redis .trino ;
2525
26- import java .io .File ;
2726import java .time .Duration ;
2827import java .util .Optional ;
2928
3433import io .airlift .configuration .Config ;
3534import io .airlift .configuration .ConfigDescription ;
3635import io .airlift .configuration .ConfigSecuritySensitive ;
37- import io .airlift .configuration .validation .FileExists ;
3836
3937public class RediSearchConfig {
4038
@@ -55,9 +53,9 @@ public class RediSearchConfig {
5553 private long tableCacheExpiration = DEFAULT_TABLE_CACHE_EXPIRATION .toSeconds ();
5654 private long tableCacheRefresh = DEFAULT_TABLE_CACHE_REFRESH .toSeconds ();
5755 private boolean cluster ;
58- private File caCertPath ;
59- private File keyPath ;
60- private File certPath ;
56+ private String caCertPath ;
57+ private String keyPath ;
58+ private String certPath ;
6159 private String keyPassword ;
6260
6361 @ Min (0 )
@@ -186,25 +184,32 @@ public RediSearchConfig setInsecure(boolean insecure) {
186184 return this ;
187185 }
188186
189- public Optional <@ FileExists File > getCaCertPath () {
190- return Optional .ofNullable (caCertPath );
187+ public Optional <String > getCaCertPath () {
188+ return optionalPath (caCertPath );
189+ }
190+
191+ private Optional <String > optionalPath (String path ) {
192+ if (path == null || path .isEmpty ()) {
193+ return Optional .empty ();
194+ }
195+ return Optional .of (path );
191196 }
192197
193198 @ Config ("redisearch.cacert-path" )
194199 @ ConfigDescription ("X.509 CA certificate file to verify with" )
195- public RediSearchConfig setCaCertPath (File path ) {
196- this .caCertPath = path ;
200+ public RediSearchConfig setCaCertPath (String caCertPath ) {
201+ this .caCertPath = caCertPath ;
197202 return this ;
198203 }
199204
200- public Optional <@ FileExists File > getKeyPath () {
201- return Optional . ofNullable (keyPath );
205+ public Optional <String > getKeyPath () {
206+ return optionalPath (keyPath );
202207 }
203208
204209 @ Config ("redisearch.key-path" )
205210 @ ConfigDescription ("PKCS#8 private key file to authenticate with (PEM format)" )
206- public RediSearchConfig setKeyPath (File path ) {
207- this .keyPath = path ;
211+ public RediSearchConfig setKeyPath (String keyPath ) {
212+ this .keyPath = keyPath ;
208213 return this ;
209214 }
210215
@@ -215,19 +220,19 @@ public Optional<String> getKeyPassword() {
215220 @ Config ("redisearch.key-password" )
216221 @ ConfigSecuritySensitive
217222 @ ConfigDescription ("Password of the private key file, or null if it's not password-protected" )
218- public RediSearchConfig setKeyPassword (String password ) {
219- this .keyPassword = password ;
223+ public RediSearchConfig setKeyPassword (String keyPassword ) {
224+ this .keyPassword = keyPassword ;
220225 return this ;
221226 }
222227
223- public Optional <@ FileExists File > getCertPath () {
224- return Optional . ofNullable (certPath );
228+ public Optional <String > getCertPath () {
229+ return optionalPath (certPath );
225230 }
226231
227232 @ Config ("redisearch.cert-path" )
228233 @ ConfigDescription ("X.509 certificate chain file to authenticate with (PEM format)" )
229- public RediSearchConfig setCertPath (File path ) {
230- this .certPath = path ;
234+ public RediSearchConfig setCertPath (String certPath ) {
235+ this .certPath = certPath ;
231236 return this ;
232237 }
233238
0 commit comments