Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
export interface PlatformManager { | ||
provider: string; | ||
shoudSendEdgeReport: boolean; | ||
|
||
isEnvVarsSet(): boolean; | ||
getURL(): string | undefined; | ||
getEnvironment(): string | undefined; | ||
getRegion(): string | undefined; | ||
getAuthToken(): string | undefined; | ||
} | ||
|
||
export class Generic implements PlatformManager { | ||
provider = 'self-hosted'; | ||
shoudSendEdgeReport = false; | ||
private token = process.env.AXIOM_TOKEN; | ||
private url = process.env.AXOIOM_URL; | ||
private env = process.env.NODE_ENV; | ||
private dataset = process.env.AXIOM_DATASET; | ||
|
||
isEnvVarsSet() { | ||
return this.url != undefined && this.dataset != undefined && this.token != undefined; | ||
} | ||
|
||
getURL() { | ||
return this.url; | ||
} | ||
|
||
getEnvironment() { | ||
return this.env; | ||
} | ||
|
||
getRegion() { | ||
return undefined; | ||
} | ||
|
||
getAuthToken() { | ||
return this.token; | ||
} | ||
} | ||
|
||
export class Vercel implements PlatformManager { | ||
provider = 'vercel'; | ||
shoudSendEdgeReport = true; | ||
|
||
isEnvVarsSet() { | ||
return process.env.AXIOM_INGEST_ENDPOINT != undefined || process.env.NEXT_PUBLIC_AXIOM_INGEST_ENDPOINT != undefined; | ||
} | ||
|
||
getURL() { | ||
return process.env.NEXT_PUBLIC_AXIOM_INGEST_ENDPOINT || process.env.AXIOM_INGEST_ENDPOINT; | ||
} | ||
|
||
getEnvironment() { | ||
return process.env.VERCEL_ENV; | ||
} | ||
|
||
getRegion() { | ||
return process.env.VERCEL_REGION; | ||
} | ||
|
||
getAuthToken() { | ||
return undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters