Skip to content

Commit

Permalink
fix: custom http headers (#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Dec 12, 2024
1 parent 847e3f9 commit 4fcbce6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
31 changes: 15 additions & 16 deletions src/screens/Developer/PaymentSettings/PaymentSettings.res
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,24 @@ module AuthenticationInput = {
onBlur: _ => (),
onChange: ev => {
let value = ReactEvent.Form.target(ev)["value"]
let regexForProfileName = "^([a-z]|[A-Z]|[0-9]|_|-)+$"
let isValid = if value->String.length <= 2 {
true
} else if (
value->isEmptyString ||
value->String.length > 64 ||
!RegExp.test(RegExp.fromString(regexForProfileName), value)
) {
false
} else {
true
}
if value->String.length <= 0 {
let name = `outgoing_webhook_custom_http_headers.${key}`
form.change(name, JSON.Encode.null)
}
switch value->getOptionIntFromString->Option.isNone {
| true => setKey(_ => value)
switch (value->getOptionIntFromString->Option.isNone, isValid) {
| (true, true) => setKey(_ => value)
| _ => ()
}
},
Expand All @@ -85,7 +97,6 @@ module AuthenticationInput = {
if key->String.length > 0 {
let name = `outgoing_webhook_custom_http_headers.${key}`
form.change(name, metaValue->JSON.Encode.string)
setAllowEdit(_ => false)
}
},
onChange: ev => {
Expand All @@ -99,6 +110,7 @@ module AuthenticationInput = {

let allowEditConfiguration = () => {
setValue(_ => "")
form.change(`outgoing_webhook_custom_http_headers.${key}`, JSON.Encode.null)
setAllowEdit(_ => true)
setShowModal(_ => false)
}
Expand Down Expand Up @@ -129,19 +141,6 @@ module AuthenticationInput = {
/>
</div>
</RenderIf>
<RenderIf condition={allowEdit}>
<div className="flex flex-row gap-2 mt-6">
<Button
text=""
customButtonStyle="bg-none !border-none"
customBackColor="bg-transparent"
rightIcon={FontAwesome("blue-tick")}
customIconSize={18}
buttonSize={XSmall}
onClick={_ => setAllowEdit(_ => false)}
/>
</div>
</RenderIf>
</div>
</RenderIf>
</DesktopRow>
Expand Down
4 changes: 2 additions & 2 deletions src/server/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ const configHandler = async (
try {
const config = await readTomlConfig(filePath, res);
let merchantConfig = config.default;

let isDomainExitsInEnv = process.env[`${domain}`];
if (config[domain] && Object.keys(config[domain]).length > 0) {
merchantConfig = updateConfigWithEnv(config[domain], domain, "theme");
} else if (domain.length > 0) {
} else if (domain.length > 0 && isDomainExitsInEnv) {
merchantConfig = updateConfigWithEnv(config.default, domain, "theme");
} else {
merchantConfig = updateConfigWithEnv(merchantConfig, "default", "");
Expand Down

0 comments on commit 4fcbce6

Please sign in to comment.