Skip to content

Instantly share code, notes, and snippets.

@Vatsalya-singhi
Created March 27, 2025 18:52
Show Gist options
  • Save Vatsalya-singhi/4a2ac25e0503a1b8f63666934a6db7dc to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/4a2ac25e0503a1b8f63666934a6db7dc to your computer and use it in GitHub Desktop.
// accessing env variables securely
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
@Injectable()
export class AppService {
constructor(private configService: ConfigService) {}
getDatabaseUrl(): string {
return this.configService.get<string>('DATABASE_URL');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment