Skip to content

Commit

Permalink
Merge pull request #502 from GurukiranP/ES_500
Browse files Browse the repository at this point in the history
[ES-500] moved env variables to config.json file.
  • Loading branch information
aranaravi authored Dec 6, 2023
2 parents 3188675 + a1266dc commit 08af78f
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 49 deletions.
4 changes: 0 additions & 4 deletions oidc-ui/.env
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ REACT_APP_WALLET_LOGO_URL=""
REACT_APP_CONSENT_SCREEN_TIME_OUT_BUFFER_IN_SEC=5

REACT_APP_WALLET_QR_CODE_AUTO_REFRESH_LIMIT=3
REACT_APP_BACKGROUND_LOGO=false
REACT_APP_FOOTER=true
REACT_APP_REMOVE_INDICATOR_PIPE=true
REACT_APP_NO_OUTLINE_TOGGLE=true
6 changes: 1 addition & 5 deletions oidc-ui/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
REACT_APP_SBI_ENV=Staging
REACT_APP_BACKGROUND_LOGO=false
REACT_APP_FOOTER=true
REACT_APP_REMOVE_INDICATOR_PIPE=true
REACT_APP_NO_OUTLINE_TOGGLE=true
REACT_APP_SBI_ENV=Staging
6 changes: 1 addition & 5 deletions oidc-ui/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
REACT_APP_SBI_ENV=Staging
REACT_APP_ESIGNET_API_URL=/v1/esignet
REACT_APP_BACKGROUND_LOGO=false
REACT_APP_FOOTER=true
REACT_APP_REMOVE_INDICATOR_PIPE=true
REACT_APP_NO_OUTLINE_TOGGLE=true
REACT_APP_ESIGNET_API_URL=/v1/esignet
10 changes: 8 additions & 2 deletions oidc-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ The application runs on PORT=3000 by default.
- REACT_APP_WALLET_LOGO_URL: URL for the logo in the wallet QRCode. This feature supports cross-origin-enabled image URLs only.
- REACT_APP_CONSENT_SCREEN_TIME_OUT_BUFFER_IN_SEC: Buffer time for the consent screen expiry timer.
- REACT_APP_WALLET_QR_CODE_AUTO_REFRESH_LIMIT: Limit for the QR code auto refresh.
- REACT_APP_BACKGROUND_LOGO: Set a logo in the main page, in ledt side of the main card
- REACT_APP_FOOTER: Set footer in the main page

- JSON configuration variables

- username_info_icon: Set info icon next to the username label in the password login.
- background_logo: Set a logo in the login and consent page, to the left side of the main card.
- footer: Set footer to the bottom of all the pages.
- remove_language_indicator_pipe: Remove the indicator pipe next to the language display in the navbar
- outline_toggle: Set outline toggler instead of slider toggler.

- Theme based configuration

Expand Down
6 changes: 5 additions & 1 deletion oidc-ui/public/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"username_info_icon": true
"username_info_icon": true,
"background_logo": false,
"footer": true,
"remove_language_indicator_pipe": true,
"outline_toggle": false
}
6 changes: 4 additions & 2 deletions oidc-ui/src/components/Background.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { configurationKeys } from "../constants/clientConstants";
import { getBooleanValue } from "../services/utilService";
import configService from "../services/configService";

const config = await configService();

export default function Background({
heading,
subheading,
Expand Down Expand Up @@ -32,7 +34,7 @@ export default function Background({
// check if background logo is needed or not,
// create div according to the environment variable
const backgroundLogoDiv =
getBooleanValue("REACT_APP_BACKGROUND_LOGO") ? (
config["background_logo"] ? (
<div className="flex justify-center m-10 lg:mt-20 mb:mt-0 lg:w-1/2 md:w-1/2 md:block sm:w-1/2 sm:block hidden w-5/6 mt-20 mb-10 md:mb-0">
<img
className="background-logo object-contain rtl:scale-x-[-1]"
Expand Down
14 changes: 7 additions & 7 deletions oidc-ui/src/components/Consent.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { LoadingStates, LoadingStates as states } from "../constants/states";
import FormAction from "./FormAction";
import langConfigService from "./../services/langConfigService";
import ModalPopup from "../common/ModalPopup";
import { getBooleanValue } from "../services/utilService";
import configService from "../services/configService";

const config = await configService();

export default function Consent({
authService,
Expand Down Expand Up @@ -46,11 +48,9 @@ export default function Consent({
const [timeLeft, setTimeLeft] = useState(null);
const [cancelPopup, setCancelPopup] = useState(false);

const slideToggleClass = getBooleanValue(
"REACT_APP_NO_OUTLINE_TOGGLE"
)
? "toggle-no-outline"
: "toggle-outline";
const slideToggleClass = config["outline_toggle"]
? "toggle-outline"
: "toggle-no-outline";

const hasAllElement = (mainArray, subArray) =>
subArray.every((ele) => mainArray.includes(ele));
Expand Down Expand Up @@ -407,7 +407,7 @@ export default function Consent({
// check if background logo is needed or not,
// create div according to the environment variable
const backgroundLogoDiv =
getBooleanValue("REACT_APP_BACKGROUND_LOGO") ? (
config["background_logo"] ? (
<div className="flex justify-center m-10 lg:mt-20 mb:mt-0 lg:w-1/2 md:w-1/2 md:block sm:w-1/2 sm:block hidden w-5/6 mt-20 mb-10 md:mb-0">
<img
className="background-logo object-contain rtl:scale-x-[-1]"
Expand Down
6 changes: 4 additions & 2 deletions oidc-ui/src/components/EsignetDetails.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useTranslation } from "react-i18next";
import { useEffect, useState } from "react";
import { LoadingStates as states } from "../constants/states";
import { getBooleanValue } from "../services/utilService";
import configService from "../services/configService";

const config = await configService();

export default function EsignetDetails({ i18nKeyPrefix = "esignetDetails" }) {
const { t } = useTranslation("translation", { keyPrefix: i18nKeyPrefix });
Expand Down Expand Up @@ -31,7 +33,7 @@ export default function EsignetDetails({ i18nKeyPrefix = "esignetDetails" }) {
// check if background logo is needed or not,
// create div according to the environment variable
const backgroundLogoDiv =
getBooleanValue("REACT_APP_BACKGROUND_LOGO") ? (
config["background_logo"] ? (
<div className="flex justify-center m-10 lg:mt-20 mb:mt-0 lg:w-1/2 md:w-1/2 md:block sm:w-1/2 sm:block hidden w-5/6 mt-20 mb-10 md:mb-0">
<img
className="background-logo object-contain rtl:scale-x-[-1]"
Expand Down
7 changes: 4 additions & 3 deletions oidc-ui/src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { useTranslation } from "react-i18next";
import { getBooleanValue } from "../services/utilService";
import configService from "../services/configService";

const config = await configService();

export default function Footer({ i18nKeyPrefix = "footer" }) {
const footerCheck = getBooleanValue("REACT_APP_FOOTER");

const { t } = useTranslation("translation", {
keyPrefix: i18nKeyPrefix,
});

return footerCheck && (
return config["footer"] && (
<footer className="footer-container flex w-full flex-row flex-wrap items-center justify-center gap-y-6 gap-x-1 border border-blue-gray-50 text-center">
{t("powered_by")}
<img className="footer-brand-logo" alt={t("logo_alt")} />
Expand Down
1 change: 0 additions & 1 deletion oidc-ui/src/components/L1Biometrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import InputWithImage from "./InputWithImage";
import ErrorIndicator from "../common/ErrorIndicator";
import { useTranslation } from "react-i18next";
import { init, propChange } from "secure-biometric-interface-integrator";
import { getBooleanValue } from "../services/utilService";

let fieldsState = {};

Expand Down
1 change: 0 additions & 1 deletion oidc-ui/src/components/LoginQRCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
walletConfigKeys,
} from "../constants/clientConstants";
import { LoadingStates as states } from "../constants/states";
import { getBooleanValue } from "../services/utilService";

var linkAuthTriggered = false;

Expand Down
8 changes: 4 additions & 4 deletions oidc-ui/src/components/NavHeader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import Select from "react-select";
import { getBooleanValue } from "../services/utilService";
import configService from "../services/configService";

const config = await configService();

export default function NavHeader({ langOptions, i18nKeyPrefix = "header" }) {
const { t, i18n } = useTranslation("translation", {
Expand All @@ -13,14 +15,12 @@ export default function NavHeader({ langOptions, i18nKeyPrefix = "header" }) {
i18n.changeLanguage(e.value);
};

const removeIndicatorPipe = getBooleanValue("REACT_APP_REMOVE_INDICATOR_PIPE");

const customStyles = {
control: (base) => ({
...base,
border: 0,
}),
...(removeIndicatorPipe && {
...(config["remove_language_indicator_pipe"] && {
valueContainer: (base) => ({
...base,
padding: 0,
Expand Down
1 change: 0 additions & 1 deletion oidc-ui/src/components/Otp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import OtpGet from "./OtpGet";
import OtpVerify from "./OtpVerify";
import { getBooleanValue } from "../services/utilService";

const OTPStatusEnum = {
getOtp: "GETOTP",
Expand Down
1 change: 0 additions & 1 deletion oidc-ui/src/components/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import FormAction from "./FormAction";
import InputWithImage from "./InputWithImage";
import ReCAPTCHA from "react-google-recaptcha";
import ErrorBanner from "../common/ErrorBanner";
import { getBooleanValue } from "../services/utilService";

const fields = passwordFields;
let fieldsState = {};
Expand Down
1 change: 0 additions & 1 deletion oidc-ui/src/components/Pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { otpFields } from "../constants/formFields";
import { LoadingStates as states } from "../constants/states";
import FormAction from "./FormAction";
import Input from "./Input";
import { getBooleanValue } from "../services/utilService";

const fields = otpFields;
let fieldsState = {};
Expand Down
9 changes: 0 additions & 9 deletions oidc-ui/src/services/utilService.js

This file was deleted.

0 comments on commit 08af78f

Please sign in to comment.