feat: configure api key using env var
This commit is contained in:
parent
3b1df332a3
commit
323fa65921
4 changed files with 17 additions and 9 deletions
|
|
@ -76,8 +76,8 @@ bool http_loop_step_body_to_buf(event_loop_conn *conn) {
|
|||
|
||||
size_t bytes_to_copy = MIN(conn->rbuf_size - conn->rbuf_read,
|
||||
ctx->req.body.expected_len - ctx->req.body.len);
|
||||
memcpy(&ctx->req.body.buf[ctx->req.body.len],
|
||||
&conn->rbuf[conn->rbuf_read], bytes_to_copy);
|
||||
memcpy(&ctx->req.body.buf[ctx->req.body.len], &conn->rbuf[conn->rbuf_read],
|
||||
bytes_to_copy);
|
||||
ctx->req.body.len += bytes_to_copy;
|
||||
conn->rbuf_read += bytes_to_copy;
|
||||
|
||||
|
|
@ -114,7 +114,8 @@ bool http_loop_step_auth(event_loop_conn *conn) {
|
|||
struct phr_header *header = &ctx->req.headers[i];
|
||||
|
||||
if ((strncmp("X-Api-Key", header->name, header->name_len) == 0) &&
|
||||
(strncmp(header->value, ctx->g->api_key, header->value_len) == 0)) {
|
||||
(strncmp(header->value, ctx->g->api_key, header->value_len) == 0) &&
|
||||
strlen(ctx->g->api_key) == header->value_len) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue