Skip to content

Commit

Permalink
update sdk dir
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Jan 23, 2024
1 parent e32e3b0 commit 165d19d
Show file tree
Hide file tree
Showing 12 changed files with 6,532 additions and 5,125 deletions.
30 changes: 30 additions & 0 deletions example/.fluentci/sdk/builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { createGQLClient } from "./client.ts";
import { Context } from "./context.ts";

/**
* @hidden
*
* Initialize a default client context from environment.
*/
export function initDefaultContext(): Context {
let ctx = new Context();

// Prefer DAGGER_SESSION_PORT if set
const daggerSessionPort = Deno.env.get("DAGGER_SESSION_PORT");
if (daggerSessionPort) {
const sessionToken = Deno.env.get("DAGGER_SESSION_TOKEN");
if (!sessionToken) {
throw new Error(
"DAGGER_SESSION_TOKEN must be set when using DAGGER_SESSION_PORT"
);
}

ctx = new Context({
client: createGQLClient(Number(daggerSessionPort), sessionToken),
});
} else {
throw new Error("DAGGER_SESSION_PORT must be set");
}

return ctx;
}
Loading

0 comments on commit 165d19d

Please sign in to comment.