Skip to content

Commit

Permalink
feat: add environment service (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
maalni authored Mar 30, 2024
1 parent 164c6a5 commit 074de33
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BACKEND_URL=""
22 changes: 22 additions & 0 deletions src/lib/services/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interface EnvVars {
readonly backendUrl: string;
}

export default class EnvironmentService {
private static instance: EnvironmentService;
public readonly variables: EnvVars;

private constructor() {
this.variables = {
backendUrl: import.meta.env.BACKEND_URL
};
}

public static getInstance(): EnvironmentService {
if (!EnvironmentService.instance) {
EnvironmentService.instance = new EnvironmentService();
}

return EnvironmentService.instance;
}
}

0 comments on commit 074de33

Please sign in to comment.