Skip to content

Commit

Permalink
allow org set in /etc
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuss committed Dec 12, 2023
1 parent c1e722d commit 81ec145
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ class GitHubConfiguration {
}

get org(): string | undefined {
return this.repository ? this.repository.split("/")[0] : undefined;
const fromFs = this.samlTo.org;
const fromEnv = this.repository ? this.repository.split("/")[0] : undefined;
// TODO: make this a config option?
return fromFs || fromEnv;
}

get repository(): string | undefined {
Expand Down Expand Up @@ -178,6 +181,7 @@ class AssumeAwsConfiguration {
}

export class SamlToConfiguration {
#org: string | undefined;
#provider: string | undefined;
#githubToken: string | undefined;
#awsRole: string | undefined;
Expand Down Expand Up @@ -208,6 +212,7 @@ export class SamlToConfiguration {
this.#provider = await readFile(
path.join(root, "etc", "saml-to", "provider")
);
this.#org = await readFile(path.join(root, "etc", "saml-to", "org"));
this.#awsRole = await readFile(
path.join(root, "etc", "saml-to", "aws", "role")
);
Expand All @@ -219,14 +224,18 @@ export class SamlToConfiguration {
);
}

get githubToken(): string | undefined {
return this.#githubToken;
get org(): string | undefined {
return this.#org;
}

get provider(): string | undefined {
return this.#provider;
}

get githubToken(): string | undefined {
return this.#githubToken;
}

get awsRole(): string | undefined {
return this.#awsRole;
}
Expand Down

0 comments on commit 81ec145

Please sign in to comment.