Skip to content

Commit f2510d9

Browse files
authored
Merge pull request #243 from leapdao/feat/regex-in-config
Allow regular expressions in config file
2 parents 38ff965 + 810040a commit f2510d9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const configs = [
22
{
3-
DOMAINS: ["localhost", "10.0.0.107", "sundai.fritz.box", "192.168.178.25"],
3+
DOMAINS: ["localhost", "10.0.0.107", "sundai.fritz.box", /192\.168\..*/, /.*\.ngrok\.io/],
44
CURRENCY: {
55
CURRENCY_LIST: ["USD", "EUR", "GBP"],
66
DEFAULT_CURRENCY: "USD"
@@ -136,7 +136,12 @@ const configs = [
136136
];
137137

138138
function findConfig(hostname) {
139-
return configs.filter(({ DOMAINS }) => DOMAINS.includes(hostname));
139+
return configs.filter(
140+
({ DOMAINS }) =>
141+
DOMAINS.filter(domain =>
142+
domain instanceof RegExp ? domain.exec(hostname) : domain === hostname
143+
).length
144+
);
140145
}
141146

142147
export default function getConfig() {

0 commit comments

Comments
 (0)