Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#171833480] Optional SPID_TESTENV_URL without default #608

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ Those are all Environment variables needed by the application:
| STARTUP_IDPS_METADATA | Stringified JSON containing idps metadata `Record<string, string>` | string |
| CIE_METADATA_URL | Url to download CIE metadata from | string |
| IDP_METADATA_URL | Url to download SPID IDPs metadata from | string |
| SPID_TESTENV_URL | Url to SPID Testenv 2 | string |
| SPID_VALIDATOR_URL | Url to SPID Validator | string |
| CACHE_MAX_AGE_SECONDS | The value in seconds for duration of in-memory api cache | int |
| CACHE_MAX_AGE_SECONDS | The value in seconds for duration of in-memory api cache | int |
| APICACHE_DEBUG | When is `true` enable the apicache debug mode | boolean |
| ALLOW_MULTIPLE_SESSIONS | When is `true` allow multiple sessions for an user (default `false`) | boolean |
| GITHUB_TOKEN | The value of your Github Api Key, used in build phase | string |
| GITHUB_TOKEN | The value of your Github Api Key, used in build phase | string |

### Logs

Expand Down
9 changes: 5 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ const SAML_ACCEPTED_CLOCK_SKEW_MS = parseInt(
// const DEFAULT_SPID_AUTOLOGIN = "";
// const SPID_AUTOLOGIN = process.env.SPID_AUTOLOGIN || DEFAULT_SPID_AUTOLOGIN;

const DEFAULT_SPID_TESTENV_URL = "https://spid-testenv2:8088";
const SPID_TESTENV_URL =
process.env.SPID_TESTENV_URL || DEFAULT_SPID_TESTENV_URL;
const SPID_TESTENV_URL = process.env.SPID_TESTENV_URL;

// Register the spidStrategy.
export const IDP_METADATA_URL = getRequiredENVVar("IDP_METADATA_URL");
Expand Down Expand Up @@ -140,6 +138,9 @@ export const appConfig: IApplicationConfig = {
const maybeSpidValidatorUrlOption = fromNullable(
process.env.SPID_VALIDATOR_URL
).map(_ => ({ [_]: true }));
const maybeSpidTestenvOption = fromNullable(SPID_TESTENV_URL).map(_ => ({
[_]: true
}));

export const serviceProviderConfig: IServiceProviderConfig = {
IDPMetadataUrl: IDP_METADATA_URL,
Expand All @@ -164,7 +165,7 @@ export const serviceProviderConfig: IServiceProviderConfig = {
spidTestEnvUrl: SPID_TESTENV_URL,
spidValidatorUrl: process.env.SPID_VALIDATOR_URL,
strictResponseValidation: {
[SPID_TESTENV_URL]: true,
...(isSome(maybeSpidTestenvOption) ? maybeSpidTestenvOption.value : {}),
...(isSome(maybeSpidValidatorUrlOption)
? maybeSpidValidatorUrlOption.value
: {})
Expand Down