-
Notifications
You must be signed in to change notification settings - Fork 1
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
Christian Alessandro Atzeni
committed
Oct 16, 2024
1 parent
aaeab65
commit b7c4b14
Showing
7 changed files
with
59 additions
and
48 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
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import { AzureConfig, getAzureConfigFromEnvironment } from "./azureConfig"; | ||
import { sequenceS } from "fp-ts/Apply"; | ||
import * as RE from "fp-ts/ReaderEither"; | ||
import * as t from "io-ts"; | ||
import { pipe } from "fp-ts/function"; | ||
import { sequenceS } from "fp-ts/Apply"; | ||
import { IoServiceConfig, getIoServiceConfigFromEnvironment } from "./ioServiceConfig"; | ||
import * as t from "io-ts"; | ||
|
||
import { AzureConfig, getAzureConfigFromEnvironment } from "./azureConfig"; | ||
import { | ||
IoServiceConfig, | ||
getIoServiceConfigFromEnvironment, | ||
} from "./ioServiceConfig"; | ||
|
||
export const CosmosDbConfig = t.type({ | ||
ioService: IoServiceConfig, | ||
azure: AzureConfig, | ||
azure: AzureConfig, | ||
ioService: IoServiceConfig, | ||
}); | ||
|
||
export type AppConfig = t.TypeOf<typeof CosmosDbConfig>; | ||
|
||
export const getAppConfigFromEnvironment: RE.ReaderEither<NodeJS.ProcessEnv, Error, AppConfig> = | ||
pipe( | ||
sequenceS(RE.Apply)({ | ||
azure: pipe( | ||
getAzureConfigFromEnvironment | ||
), | ||
ioService: pipe( | ||
getIoServiceConfigFromEnvironment | ||
) | ||
}) | ||
); | ||
export const getAppConfigFromEnvironment: RE.ReaderEither< | ||
NodeJS.ProcessEnv, | ||
Error, | ||
AppConfig | ||
> = pipe( | ||
sequenceS(RE.Apply)({ | ||
azure: pipe(getAzureConfigFromEnvironment), | ||
ioService: pipe(getIoServiceConfigFromEnvironment), | ||
}), | ||
); |
41 changes: 21 additions & 20 deletions
41
apps/io-wallet-message-func/src/app/configs/ioServiceConfig.ts
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 |
---|---|---|
@@ -1,27 +1,28 @@ | ||
import * as t from "io-ts"; | ||
import { pipe } from "fp-ts/function"; | ||
import { sequenceS } from "fp-ts/Apply"; | ||
import { readFromEnvironment } from "io-wallet-common/infra/env"; | ||
import * as RE from "fp-ts/ReaderEither"; | ||
import { pipe } from "fp-ts/function"; | ||
import * as t from "io-ts"; | ||
import { readFromEnvironment } from "io-wallet-common/infra/env"; | ||
|
||
export const IoServiceConfig = t.type({ | ||
ioServiceBaseUrl: t.string, | ||
ioServiceApiKey: t.string, | ||
ioServiceRequestTimeout: t.number | ||
ioServiceApiKey: t.string, | ||
ioServiceBaseUrl: t.string, | ||
ioServiceRequestTimeout: t.number, | ||
}); | ||
|
||
export type IoServiceConfig = t.TypeOf<typeof IoServiceConfig>; | ||
|
||
export const getIoServiceConfigFromEnvironment: RE.ReaderEither<NodeJS.ProcessEnv, Error, IoServiceConfig> = | ||
pipe( | ||
sequenceS(RE.Apply)({ | ||
ioServiceBaseUrl: readFromEnvironment("IoServiceBaseUrl"), | ||
ioServiceApiKey: readFromEnvironment("IoServiceApiKey"), | ||
ioServiceRequestTimeout: pipe( | ||
readFromEnvironment("IoServiceRequestTimeout"), | ||
RE.map( | ||
(value) => Number.parseInt(value) | ||
) | ||
) | ||
}), | ||
); | ||
export const getIoServiceConfigFromEnvironment: RE.ReaderEither< | ||
NodeJS.ProcessEnv, | ||
Error, | ||
IoServiceConfig | ||
> = pipe( | ||
sequenceS(RE.Apply)({ | ||
ioServiceApiKey: readFromEnvironment("IoServiceApiKey"), | ||
ioServiceBaseUrl: readFromEnvironment("IoServiceBaseUrl"), | ||
ioServiceRequestTimeout: pipe( | ||
readFromEnvironment("IoServiceRequestTimeout"), | ||
RE.map((value) => Number.parseInt(value, 10)), | ||
), | ||
}), | ||
); |
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
3 changes: 2 additions & 1 deletion
3
apps/io-wallet-message-func/src/infra/azure/functions/health.ts
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { HealthHandler } from "@/infra/http/handlers/health"; | ||
import { httpAzureFunction } from "@pagopa/handler-kit-azure-func"; | ||
|
||
import { HealthHandler } from "../../http/handlers/health"; | ||
|
||
export const HealthFunction = httpAzureFunction(HealthHandler); |
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