如何在flagsmith中跳过TLS验证?

dev*_*evi 5 go tls1.2 feature-flags flagsmith

我想跳过 flagsmith 的 TLS 验证。

注意:我使用的是flagsmithv3 go sdk。

这是我当前的代码:

func InitializeFlagsmith() *flagsmith.Client {
    apiKey := "ser..."
    customerAPIEndpoint := "https://example.com/api/v1/"

    // Create Flagsmith client options
    options := []flagsmith.Option{
        flagsmith.WithBaseURL(customerAPIEndpoint),
        flagsmith.WithLocalEvaluation(context.Background()),
        flagsmith.WithEnvironmentRefreshInterval(60 * time.Second),
    }

    // Initialize Flagsmith client with custom options
    flagsmithClient := flagsmith.NewClient(apiKey, options...)

    return flagsmithClient
}
Run Code Online (Sandbox Code Playgroud)

我检查了flagsmith代码,所以我发现了这一点,如何更改 &Client 中的客户端?

// NewClient creates instance of Client with given configuration.
func NewClient(apiKey string, options ...Option) *Client {
    c := &Client{
        apiKey: apiKey,
        config: defaultConfig(),
        client: flaghttp.NewClient(),
    }

    c.client.SetHeaders(map[string]string{
        "Accept":            "application/json",
        "X-Environment-Key": c.apiKey,
    })
    c.client.SetTimeout(c.config.timeout)
    ....

Run Code Online (Sandbox Code Playgroud)

小智 2

目前还不可能,但这是一个很好的用例,我们将实现它。我在这里为此创建了一个问题

全面披露:我为flagsmith工作并编写了该 SDK