Skip to content

Commit

Permalink
Use indy-client 3.4.0-SNAPSHOT
Browse files Browse the repository at this point in the history
   Because indy-client 3.4.0-SNAPSHOT has removed the o11yphant deps,
   this needs some code change in Indy side
  • Loading branch information
ligangty committed Jul 29, 2024
1 parent 62e0dd2 commit 42c3651
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

<!-- commonjava/redhat projects -->
<indyModelVersion>1.5</indyModelVersion>
<indyClientVersion>3.3.3</indyClientVersion>
<indyClientVersion>3.4.0-SNAPSHOT</indyClientVersion>
<atlasVersion>1.1.1</atlasVersion>
<galleyVersion>1.16</galleyVersion>
<weftVersion>1.22</weftVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.commonjava.indy.client.core.auth.IndyClientAuthenticator;
import org.commonjava.indy.client.core.module.IndyStoreQueryClientModule;
import org.commonjava.indy.client.core.module.IndyStoresClientModule;
import org.commonjava.indy.client.core.o11y.trace.ClientTracerConfiguration;
import org.commonjava.indy.model.core.io.IndyObjectMapper;
import org.commonjava.indy.subsys.trace.config.IndyTraceConfiguration;
import org.commonjava.indy.subsys.service.config.RepositoryServiceConfig;
Expand Down Expand Up @@ -69,14 +70,25 @@ public void init()
Collection<IndyClientModule> modules =
Arrays.asList( new IndyStoresClientModule(), new IndyStoreQueryClientModule() );


try
{

final Indy.Builder builder = Indy.builder()
.setLocation( config )
.setObjectMapper( new IndyObjectMapper( Collections.emptySet() ) )
.setExistedTraceConfig( indyTraceConfig )
.setMdcCopyMappings( Collections.emptyMap() )
.setModules( modules.toArray( new IndyClientModule[0] ) );
if ( indyTraceConfig != null && indyTraceConfig.isEnabled() )
{
ClientTracerConfiguration clientTracerConfig = new ClientTracerConfiguration();
clientTracerConfig.setEnabled( true );
clientTracerConfig.setConsoleTransport( indyTraceConfig.isConsoleTransport() );
clientTracerConfig.setGrpcHeaders( indyTraceConfig.getGrpcHeaders() );
clientTracerConfig.setGrpcUri( indyTraceConfig.getGrpcEndpointUri() );
clientTracerConfig.setGrpcResources( indyTraceConfig.getResources() );
builder.setTraceConfiguration( clientTracerConfig );
}
if ( serviceConfig.isAuthEnabled() )
{
IndyClientAuthenticator authenticator =
Expand All @@ -85,13 +97,14 @@ public void init()
serviceConfig.getKeycloakClientId(),
serviceConfig.getKeycloakClientSecret(),
serviceConfig.getRefreshTokenTimeSkew() );
client = builder.setAuthenticator( authenticator ).build();
builder.setAuthenticator( authenticator );
}
else
{
client = builder.setPasswordManager( new MemoryPasswordManager() ).build();
builder.setPasswordManager( new MemoryPasswordManager() );
}

client = builder.build();
}
catch ( IndyClientException e )
{
Expand Down

0 comments on commit 42c3651

Please sign in to comment.