@@ -268,16 +268,22 @@ static int cb_zerobus_init(struct flb_output_instance *ins,
268268 }
269269
270270 /*
271- * URL fields need https:// prepending when no scheme is present
272- * (the ZeroBus SDK requires a scheme), so they are read manually .
271+ * endpoint must include a URL scheme ( https:// or http://).
272+ * workspace_url gets https:// prepended when no scheme is present .
273273 */
274- tmp = flb_output_get_property ("zerobus_endpoint " , ins );
274+ tmp = flb_output_get_property ("endpoint " , ins );
275275 if (!tmp || strlen (tmp ) == 0 ) {
276- flb_plg_error (ins , "'zerobus_endpoint ' is required" );
276+ flb_plg_error (ins , "'endpoint ' is required" );
277277 goto init_error ;
278278 }
279- ctx -> zerobus_endpoint = ensure_url_scheme (tmp );
280- if (!ctx -> zerobus_endpoint ) {
279+ if (strncmp (tmp , "https://" , 8 ) != 0 && strncmp (tmp , "http://" , 7 ) != 0 ) {
280+ flb_plg_error (ins ,
281+ "'endpoint' must include a URL scheme "
282+ "(e.g. https://...), got: %s" , tmp );
283+ goto init_error ;
284+ }
285+ ctx -> endpoint = flb_sds_create (tmp );
286+ if (!ctx -> endpoint ) {
281287 goto init_error ;
282288 }
283289
@@ -305,15 +311,15 @@ static int cb_zerobus_init(struct flb_output_instance *ins,
305311 }
306312
307313 memset (& result , 0 , sizeof (result ));
308- ctx -> sdk = zerobus_sdk_new (ctx -> zerobus_endpoint ,
314+ ctx -> sdk = zerobus_sdk_new (ctx -> endpoint ,
309315 ctx -> workspace_url ,
310316 & result );
311317 if (!ctx -> sdk || !result .success ) {
312318 log_cresult_error (ins , & result , "failed to create ZeroBus SDK" );
313319 goto init_error ;
314320 }
315321
316- if (strncmp (ctx -> zerobus_endpoint , "http://" , 7 ) == 0 ) {
322+ if (strncmp (ctx -> endpoint , "http://" , 7 ) == 0 ) {
317323 zerobus_sdk_set_use_tls (ctx -> sdk , false);
318324 }
319325
@@ -336,14 +342,14 @@ static int cb_zerobus_init(struct flb_output_instance *ins,
336342 }
337343
338344 flb_plg_info (ins , "connected to %s, table: %s" ,
339- ctx -> zerobus_endpoint , ctx -> table_name );
345+ ctx -> endpoint , ctx -> table_name );
340346
341347 flb_output_set_context (ins , ctx );
342348 return 0 ;
343349
344350init_error :
345- if (ctx -> zerobus_endpoint ) {
346- flb_sds_destroy (ctx -> zerobus_endpoint );
351+ if (ctx -> endpoint ) {
352+ flb_sds_destroy (ctx -> endpoint );
347353 }
348354 if (ctx -> workspace_url ) {
349355 flb_sds_destroy (ctx -> workspace_url );
@@ -500,8 +506,8 @@ static int cb_zerobus_exit(void *data, struct flb_config *config)
500506 zerobus_sdk_free (ctx -> sdk );
501507 }
502508
503- if (ctx -> zerobus_endpoint ) {
504- flb_sds_destroy (ctx -> zerobus_endpoint );
509+ if (ctx -> endpoint ) {
510+ flb_sds_destroy (ctx -> endpoint );
505511 }
506512 if (ctx -> workspace_url ) {
507513 flb_sds_destroy (ctx -> workspace_url );
@@ -513,9 +519,9 @@ static int cb_zerobus_exit(void *data, struct flb_config *config)
513519
514520static struct flb_config_map config_map [] = {
515521 {
516- FLB_CONFIG_MAP_STR , "zerobus_endpoint " , NULL ,
522+ FLB_CONFIG_MAP_STR , "endpoint " , NULL ,
517523 0 , FLB_FALSE , 0 ,
518- "ZeroBus gRPC endpoint URL"
524+ "ZeroBus gRPC endpoint URL (must include https:// scheme) "
519525 },
520526 {
521527 FLB_CONFIG_MAP_STR , "workspace_url" , NULL ,
0 commit comments