Skip to content

Commit

Permalink
support OSC_ENDPOINT_API
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Jun 16, 2022
1 parent e48e73b commit 9e5ecb5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,24 @@ int osc_init_sdk(struct osc_env *e, unsigned int flag)
{
char ak_sk[AK_SIZE + SK_SIZE + 2];
char *ca = getenv("CURL_CA_BUNDLE");
char *endpoint;

e->ak = getenv("OSC_ACCESS_KEY");
e->sk = getenv("OSC_SECRET_KEY");
e->region = getenv("OSC_REGION");
endpoint = getenv("OSC_ENDPOINT_API");
osc_init_str(&e->endpoint);

if (!e->region)
e->region = "eu-west-2";

osc_str_append_string(&e->endpoint, "https://api.");
osc_str_append_string(&e->endpoint, e->region);
osc_str_append_string(&e->endpoint, ".outscale.com");
if (!endpoint) {
osc_str_append_string(&e->endpoint, "https://api.");
osc_str_append_string(&e->endpoint, e->region);
osc_str_append_string(&e->endpoint, ".outscale.com");
} else {
osc_str_append_string(&e->endpoint, endpoint);
}

if (!e->ak || !e->sk) {
fprintf(stderr, "OSC_ACCESS_KEY and OSC_SECRET_KEY needed\n");
Expand Down

0 comments on commit 9e5ecb5

Please sign in to comment.