Adding app config module

This commit is contained in:
Noah Spannbauer
2024-05-26 19:28:28 -05:00
parent 294ac4e061
commit 80a86a281c
8 changed files with 142 additions and 16 deletions

2
api/.gitignore vendored
View File

@@ -54,3 +54,5 @@ pids
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
local.settings.json

View File

@@ -1,7 +0,0 @@
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "node"
}
}

View File

@@ -26,6 +26,7 @@
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@noahspan/noahspan-modules": "^0.0.1",
"@schematics/angular": "^17.3.7",
"dotenv": "^16.4.5",
"reflect-metadata": "0.1.13",

View File

@@ -1,12 +1,15 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
import { AzAppConfigService } from '@noahspan/noahspan-modules';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
constructor(private readonly azAppConfigService: AzAppConfigService) {}
@Get()
getHello(): string {
return this.appService.getHello();
@Get('featureFlag')
getFeatureFlag(key: string, label: string): string {
const featureFlag = this.azAppConfigService.getFeatureFlag(key, label);
console.log(process.env.AZ_APP_CONFIG_CONNECTION_STRING);
return 'blah';
}
}

View File

@@ -1,9 +1,14 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AzAppConfigModule } from '@noahspan/noahspan-modules';
@Module({
imports: [],
imports: [
AzAppConfigModule.register({
connectionString: process.env.AZ_APP_CONFIG_CONNECTION_STRING
})
],
controllers: [AppController],
providers: [AppService]
})