Skip to content

Commit 086d33e

Browse files
authored
Env-configs: make REMOTE_CONNECTOR_CATALOG_URL optional (#16346)
1 parent d105177 commit 086d33e

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

airbyte-config/config-models/src/main/java/io/airbyte/config/Configs.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.nio.file.Path;
1212
import java.util.List;
1313
import java.util.Map;
14+
import java.util.Optional;
1415
import java.util.Set;
1516

1617
/**
@@ -74,8 +75,10 @@ public interface Configs {
7475

7576
/**
7677
* Defines the URL to pull the remote connector catalog from.
78+
*
79+
* @return
7780
*/
78-
URI getRemoteConnectorCatalogUrl();
81+
Optional<URI> getRemoteConnectorCatalogUrl();
7982

8083
// Docker Only
8184

airbyte-config/config-models/src/main/java/io/airbyte/config/EnvConfigs.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,13 @@ public Path getWorkspaceRoot() {
327327
}
328328

329329
@Override
330-
public URI getRemoteConnectorCatalogUrl() {
331-
// Default to reuse the job database
332-
return URI.create(getEnsureEnv(REMOTE_CONNECTOR_CATALOG_URL));
330+
public Optional<URI> getRemoteConnectorCatalogUrl() {
331+
final String remoteConnectorCatalogUrl = getEnvOrDefault(REMOTE_CONNECTOR_CATALOG_URL, null);
332+
if (remoteConnectorCatalogUrl != null) {
333+
return Optional.of(URI.create(remoteConnectorCatalogUrl));
334+
} else {
335+
return Optional.empty();
336+
}
333337
}
334338

335339
// Docker Only

airbyte-config/config-models/src/test/java/io/airbyte/config/EnvConfigsTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
import io.airbyte.config.Configs.DeploymentMode;
1111
import io.airbyte.config.Configs.JobErrorReportingStrategy;
1212
import io.airbyte.config.Configs.WorkerEnvironment;
13+
import java.net.URI;
1314
import java.nio.file.Paths;
1415
import java.util.HashMap;
1516
import java.util.List;
1617
import java.util.Map;
18+
import java.util.Optional;
1719
import org.junit.jupiter.api.BeforeEach;
1820
import org.junit.jupiter.api.DisplayName;
1921
import org.junit.jupiter.api.Nested;
@@ -469,4 +471,16 @@ void testAllJobEnvMapRetrieval() {
469471
assertEquals(expected, config.getJobDefaultEnvMap());
470472
}
471473

474+
@Test
475+
void testRemoteConnectorCatalogUrl() {
476+
envMap.put(EnvConfigs.REMOTE_CONNECTOR_CATALOG_URL, null);
477+
assertEquals(Optional.empty(), config.getRemoteConnectorCatalogUrl());
478+
479+
envMap.put(EnvConfigs.REMOTE_CONNECTOR_CATALOG_URL, "");
480+
assertEquals(Optional.empty(), config.getRemoteConnectorCatalogUrl());
481+
482+
envMap.put(EnvConfigs.REMOTE_CONNECTOR_CATALOG_URL, "https://airbyte.com");
483+
assertEquals(Optional.of(URI.create("https://airbyte.com")), config.getRemoteConnectorCatalogUrl());
484+
}
485+
472486
}

airbyte-config/init/src/main/java/io/airbyte/config/init/DefinitionProviderToConfigPersistenceAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ public Map<String, Stream<JsonNode>> dumpConfigs() throws IOException {
9898
@Override
9999
public void loadData(ConfigPersistence seedPersistence) throws IOException {
100100
throw new UnsupportedOperationException(PERSISTENCE_READ_ONLY_ERROR_MSG);
101+
}
101102

103+
public DefinitionsProvider getDefinitionsProvider() {
104+
return definitionsProvider;
102105
}
103106

104107
}

0 commit comments

Comments
 (0)