feat(landerctl): allow configuring CA bundle file
ci/woodpecker/push/docker Pipeline was successful
Details
ci/woodpecker/push/docker Pipeline was successful
Details
parent
46b404acac
commit
5dc9b99a0a
|
@ -8,6 +8,7 @@
|
||||||
typedef struct landerctl_cfg {
|
typedef struct landerctl_cfg {
|
||||||
const char *api_key;
|
const char *api_key;
|
||||||
const char *server_url;
|
const char *server_url;
|
||||||
|
const char *ca_certs_bundle;
|
||||||
} landerctl_cfg;
|
} landerctl_cfg;
|
||||||
|
|
||||||
typedef enum landerctl_cfg_err {
|
typedef enum landerctl_cfg_err {
|
||||||
|
|
|
@ -20,6 +20,7 @@ landerctl_cfg_err landerctl_cfg_parse(landerctl_cfg *out, const char *path) {
|
||||||
} key_to_vars[] = {
|
} key_to_vars[] = {
|
||||||
{"api_key", &out->api_key},
|
{"api_key", &out->api_key},
|
||||||
{"server_url", &out->server_url},
|
{"server_url", &out->server_url},
|
||||||
|
{"ca_certs_bundle", &out->ca_certs_bundle},
|
||||||
};
|
};
|
||||||
size_t key_to_vars_len = sizeof(key_to_vars) / sizeof(key_to_vars[0]);
|
size_t key_to_vars_len = sizeof(key_to_vars) / sizeof(key_to_vars[0]);
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt(ctx.curl, CURLOPT_HTTPHEADER, ctx.headers);
|
curl_easy_setopt(ctx.curl, CURLOPT_HTTPHEADER, ctx.headers);
|
||||||
|
curl_easy_setopt(ctx.curl, CURLOPT_CAINFO, ctx.cfg.ca_certs_bundle);
|
||||||
|
|
||||||
char curl_err_msg[CURL_ERROR_SIZE];
|
char curl_err_msg[CURL_ERROR_SIZE];
|
||||||
curl_easy_setopt(ctx.curl, CURLOPT_ERRORBUFFER, curl_err_msg);
|
curl_easy_setopt(ctx.curl, CURLOPT_ERRORBUFFER, curl_err_msg);
|
||||||
|
|
Loading…
Reference in New Issue