Skip to content

Commit

Permalink
Env-configs: make REMOTE_CONNECTOR_CATALOG_URL optional (#16346)
Browse files Browse the repository at this point in the history
  • Loading branch information
alafanechere authored Sep 7, 2022
1 parent d105177 commit 086d33e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -74,8 +75,10 @@ public interface Configs {

/**
* Defines the URL to pull the remote connector catalog from.
*
* @return
*/
URI getRemoteConnectorCatalogUrl();
Optional<URI> getRemoteConnectorCatalogUrl();

// Docker Only

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,13 @@ public Path getWorkspaceRoot() {
}

@Override
public URI getRemoteConnectorCatalogUrl() {
// Default to reuse the job database
return URI.create(getEnsureEnv(REMOTE_CONNECTOR_CATALOG_URL));
public Optional<URI> getRemoteConnectorCatalogUrl() {
final String remoteConnectorCatalogUrl = getEnvOrDefault(REMOTE_CONNECTOR_CATALOG_URL, null);
if (remoteConnectorCatalogUrl != null) {
return Optional.of(URI.create(remoteConnectorCatalogUrl));
} else {
return Optional.empty();
}
}

// Docker Only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import io.airbyte.config.Configs.DeploymentMode;
import io.airbyte.config.Configs.JobErrorReportingStrategy;
import io.airbyte.config.Configs.WorkerEnvironment;
import java.net.URI;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
Expand Down Expand Up @@ -469,4 +471,16 @@ void testAllJobEnvMapRetrieval() {
assertEquals(expected, config.getJobDefaultEnvMap());
}

@Test
void testRemoteConnectorCatalogUrl() {
envMap.put(EnvConfigs.REMOTE_CONNECTOR_CATALOG_URL, null);
assertEquals(Optional.empty(), config.getRemoteConnectorCatalogUrl());

envMap.put(EnvConfigs.REMOTE_CONNECTOR_CATALOG_URL, "");
assertEquals(Optional.empty(), config.getRemoteConnectorCatalogUrl());

envMap.put(EnvConfigs.REMOTE_CONNECTOR_CATALOG_URL, "https://airbyte.com");
assertEquals(Optional.of(URI.create("https://airbyte.com")), config.getRemoteConnectorCatalogUrl());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ public Map<String, Stream<JsonNode>> dumpConfigs() throws IOException {
@Override
public void loadData(ConfigPersistence seedPersistence) throws IOException {
throw new UnsupportedOperationException(PERSISTENCE_READ_ONLY_ERROR_MSG);
}

public DefinitionsProvider getDefinitionsProvider() {
return definitionsProvider;
}

}

0 comments on commit 086d33e

Please sign in to comment.