24 lines
480 B
C
24 lines
480 B
C
|
// Written by retoor@molodetz.nl
|
||
|
|
||
|
// This source code declares a constant character pointer variable with a value representing an API key.
|
||
|
|
||
|
|
||
|
|
||
|
// MIT License
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
const char * resolve_api_key(){
|
||
|
char * api_key = getenv("R_KEY");
|
||
|
if(api_key)
|
||
|
{
|
||
|
return api_key;
|
||
|
}
|
||
|
api_key = getenv("OPENAI_API_KEY");
|
||
|
if(api_key)
|
||
|
{
|
||
|
return api_key;
|
||
|
}
|
||
|
fprintf(stderr, "There is no API key configured in environment.");
|
||
|
return "";
|
||
|
}
|