Skip to main content

Get gRPC connection settings

Gets the settings structure for gRPC connection

Function GetGRPCConnectionSettings(Val Address, Val Authorization = Undefined, Val Meta = Undefined, Val Tls = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Address--urlStringConnection address with protocol and port
Authorization--authString, Structure Of KeyAndValueAuthorization: string for JWT, structure for basic
Meta--metaStructure Of KeyAndValuegRPC metadata structure, if necessary
Tls--tlsStructure Of KeyAndValueTLS settings. See GetTlsSettings
Returns

Structure Of KeyAndValue - Connection settings structure

1C:Enterprise/OneScript code example
URL = "http://localhost:9101";
// No authorization

Result = OPI_ClickHouse.GetGRPCConnectionSettings(URL);

// With basic authorization

Login = "bayselonarrend";
Password = "12we...";

Authorization = New Structure(Login, Password);

Result = OPI_ClickHouse.GetGRPCConnectionSettings(URL, Authorization);

// With JWT authorization

JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.test";

Result = OPI_ClickHouse.GetGRPCConnectionSettings(URL, JWT);

// With metadata

Meta = New Map;
Meta.Insert("custom-meta", "value");

Result = OPI_ClickHouse.GetGRPCConnectionSettings(URL, Authorization, Meta);

// With TLS settings

Tls = OPI_ClickHouse.GetTlsSettings(True);

Result = OPI_ClickHouse.GetGRPCConnectionSettings(URL, Authorization, , Tls);
# JSON data can also be passed as a path to a .json file

oint clickhouse GetGRPCConnectionSettings \
--url "http://127.0.0.1:9101" \
--auth "{'bayselonarrend':'***'}"
Result
{
"address": "http://host.docker.internal:9101",
"tls": {
"use_tls": true,
"accept_invalid_certs": true
},
"transport": "grpc",
"auth_type": "basic",
"user": "bayselonarrend",
"password": "***"
}