feat(landerctl): allow configuring CA bundle file
ci/woodpecker/push/docker Pipeline was successful Details

release/0.2.0
Jef Roosens 2023-11-17 10:29:24 +01:00
parent 46b404acac
commit 5dc9b99a0a
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,7 @@
typedef struct landerctl_cfg {
const char *api_key;
const char *server_url;
const char *ca_certs_bundle;
} landerctl_cfg;
typedef enum landerctl_cfg_err {

View File

@ -20,6 +20,7 @@ landerctl_cfg_err landerctl_cfg_parse(landerctl_cfg *out, const char *path) {
} key_to_vars[] = {
{"api_key", &out->api_key},
{"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]);

View File

@ -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_CAINFO, ctx.cfg.ca_certs_bundle);
char curl_err_msg[CURL_ERROR_SIZE];
curl_easy_setopt(ctx.curl, CURLOPT_ERRORBUFFER, curl_err_msg);