Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
cf62ddb1
Unverified
Commit
cf62ddb1
authored
Oct 05, 2023
by
tom goriunov
Committed by
GitHub
Oct 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix envs validator (#1259)
[skip ci] fix envs validator
parent
57e70751
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
utils.ts
configs/app/utils.ts
+3
-1
.env.main.L2
configs/envs/.env.main.L2
+3
-0
schema.ts
deploy/tools/envs-validator/schema.ts
+10
-7
No files found.
configs/app/utils.ts
View file @
cf62ddb1
import
isBrowser
from
'
lib/isBrowser
'
;
import
isBrowser
from
'
lib/isBrowser
'
;
import
*
as
regexp
from
'
lib/regexp
'
;
import
*
as
regexp
from
'
lib/regexp
'
;
export
const
replaceQuotes
=
(
value
:
string
|
undefined
)
=>
value
?.
replaceAll
(
'
\'
'
,
'
"
'
);
export
const
getEnvValue
=
(
envName
:
string
)
=>
{
export
const
getEnvValue
=
(
envName
:
string
)
=>
{
const
envs
=
isBrowser
()
?
window
.
__envs
:
process
.
env
;
const
envs
=
isBrowser
()
?
window
.
__envs
:
process
.
env
;
...
@@ -12,7 +14,7 @@ export const getEnvValue = (envName: string) => {
...
@@ -12,7 +14,7 @@ export const getEnvValue = (envName: string) => {
}
}
}
}
return
envs
[
envName
]?.
replaceAll
(
'
\'
'
,
'
"
'
);
return
replaceQuotes
(
envs
[
envName
]
);
};
};
export
const
parseEnvJson
=
<
DataType
>
(
env
:
string
|
undefined
):
DataType
|
null
=>
{
export
const
parseEnvJson
=
<
DataType
>
(
env
:
string
|
undefined
):
DataType
|
null
=>
{
...
...
configs/envs/.env.main.L2
View file @
cf62ddb1
...
@@ -36,6 +36,9 @@ NEXT_PUBLIC_VIEWS_ADDRESS_IDENTICON_TYPE=gradient_avatar
...
@@ -36,6 +36,9 @@ NEXT_PUBLIC_VIEWS_ADDRESS_IDENTICON_TYPE=gradient_avatar
# app features
# app features
NEXT_PUBLIC_APP_ENV=development
NEXT_PUBLIC_APP_ENV=development
NEXT_PUBLIC_AD_BANNER_PROVIDER=adbutler
NEXT_PUBLIC_AD_ADBUTLER_CONFIG_DESKTOP='{ "id": "632019", "width": "728", "height": "90" }'
NEXT_PUBLIC_AD_ADBUTLER_CONFIG_MOBILE="{ 'id': '632018', 'width': '320', 'height': '100' }"
NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0x4a0ed8ddf751a7cb5297f827699117b0f6d21a0b2907594d300dc9fed75c7e62
NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0x4a0ed8ddf751a7cb5297f827699117b0f6d21a0b2907594d300dc9fed75c7e62
NEXT_PUBLIC_WEB3_WALLETS=['coinbase']
NEXT_PUBLIC_WEB3_WALLETS=['coinbase']
NEXT_PUBLIC_WEB3_DISABLE_ADD_TOKEN_TO_WALLET=true
NEXT_PUBLIC_WEB3_DISABLE_ADD_TOKEN_TO_WALLET=true
...
...
deploy/tools/envs-validator/schema.ts
View file @
cf62ddb1
...
@@ -22,7 +22,7 @@ import { IDENTICON_TYPES } from '../../../types/views/address';
...
@@ -22,7 +22,7 @@ import { IDENTICON_TYPES } from '../../../types/views/address';
import
{
BLOCK_FIELDS_IDS
}
from
'
../../../types/views/block
'
;
import
{
BLOCK_FIELDS_IDS
}
from
'
../../../types/views/block
'
;
import
type
{
BlockFieldId
}
from
'
../../../types/views/block
'
;
import
type
{
BlockFieldId
}
from
'
../../../types/views/block
'
;
import
{
getEnvValue
}
from
'
../../../configs/app/utils
'
;
import
{
replaceQuotes
}
from
'
../../../configs/app/utils
'
;
import
*
as
regexp
from
'
../../../lib/regexp
'
;
import
*
as
regexp
from
'
../../../lib/regexp
'
;
const
protocols
=
[
'
http
'
,
'
https
'
];
const
protocols
=
[
'
http
'
,
'
https
'
];
...
@@ -119,7 +119,7 @@ const rollupSchema = yup
...
@@ -119,7 +119,7 @@ const rollupSchema = yup
const
adButlerConfigSchema
=
yup
const
adButlerConfigSchema
=
yup
.
object
<
AdButlerConfig
>
()
.
object
<
AdButlerConfig
>
()
.
transform
(
getEnvValue
)
.
transform
(
replaceQuotes
)
.
json
()
.
json
()
.
when
(
'
NEXT_PUBLIC_AD_BANNER_PROVIDER
'
,
{
.
when
(
'
NEXT_PUBLIC_AD_BANNER_PROVIDER
'
,
{
is
:
(
value
:
AdBannerProviders
)
=>
value
===
'
adbutler
'
,
is
:
(
value
:
AdBannerProviders
)
=>
value
===
'
adbutler
'
,
...
@@ -288,7 +288,7 @@ const schema = yup
...
@@ -288,7 +288,7 @@ const schema = yup
// a. homepage
// a. homepage
NEXT_PUBLIC_HOMEPAGE_CHARTS
:
yup
NEXT_PUBLIC_HOMEPAGE_CHARTS
:
yup
.
array
()
.
array
()
.
transform
(
getEnvValue
)
.
transform
(
replaceQuotes
)
.
json
()
.
json
()
.
of
(
yup
.
string
<
ChainIndicatorId
>
().
oneOf
([
'
daily_txs
'
,
'
coin_price
'
,
'
market_cap
'
])),
.
of
(
yup
.
string
<
ChainIndicatorId
>
().
oneOf
([
'
daily_txs
'
,
'
coin_price
'
,
'
market_cap
'
])),
NEXT_PUBLIC_HOMEPAGE_PLATE_TEXT_COLOR
:
yup
.
string
(),
NEXT_PUBLIC_HOMEPAGE_PLATE_TEXT_COLOR
:
yup
.
string
(),
...
@@ -303,7 +303,7 @@ const schema = yup
...
@@ -303,7 +303,7 @@ const schema = yup
.
of
(
featuredNetworkSchema
),
.
of
(
featuredNetworkSchema
),
NEXT_PUBLIC_OTHER_LINKS
:
yup
NEXT_PUBLIC_OTHER_LINKS
:
yup
.
array
()
.
array
()
.
transform
(
getEnvValue
)
.
transform
(
replaceQuotes
)
.
json
()
.
json
()
.
of
(
navItemExternalSchema
),
.
of
(
navItemExternalSchema
),
NEXT_PUBLIC_NETWORK_LOGO
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NETWORK_LOGO
:
yup
.
string
().
test
(
urlTest
),
...
@@ -320,7 +320,7 @@ const schema = yup
...
@@ -320,7 +320,7 @@ const schema = yup
// d. views
// d. views
NEXT_PUBLIC_VIEWS_BLOCK_HIDDEN_FIELDS
:
yup
NEXT_PUBLIC_VIEWS_BLOCK_HIDDEN_FIELDS
:
yup
.
array
()
.
array
()
.
transform
(
getEnvValue
)
.
transform
(
replaceQuotes
)
.
json
()
.
json
()
.
of
(
yup
.
string
<
BlockFieldId
>
().
oneOf
(
BLOCK_FIELDS_IDS
)),
.
of
(
yup
.
string
<
BlockFieldId
>
().
oneOf
(
BLOCK_FIELDS_IDS
)),
NEXT_PUBLIC_VIEWS_ADDRESS_IDENTICON_TYPE
:
yup
.
string
().
oneOf
(
IDENTICON_TYPES
),
NEXT_PUBLIC_VIEWS_ADDRESS_IDENTICON_TYPE
:
yup
.
string
().
oneOf
(
IDENTICON_TYPES
),
...
@@ -328,7 +328,7 @@ const schema = yup
...
@@ -328,7 +328,7 @@ const schema = yup
// e. misc
// e. misc
NEXT_PUBLIC_NETWORK_EXPLORERS
:
yup
NEXT_PUBLIC_NETWORK_EXPLORERS
:
yup
.
array
()
.
array
()
.
transform
(
getEnvValue
)
.
transform
(
replaceQuotes
)
.
json
()
.
json
()
.
of
(
networkExplorerSchema
),
.
of
(
networkExplorerSchema
),
NEXT_PUBLIC_HIDE_INDEXING_ALERT
:
yup
.
boolean
(),
NEXT_PUBLIC_HIDE_INDEXING_ALERT
:
yup
.
boolean
(),
...
@@ -346,7 +346,7 @@ const schema = yup
...
@@ -346,7 +346,7 @@ const schema = yup
const
isNoneSchema
=
yup
.
string
().
equals
([
'
none
'
]);
const
isNoneSchema
=
yup
.
string
().
equals
([
'
none
'
]);
const
isArrayOfWalletsSchema
=
yup
const
isArrayOfWalletsSchema
=
yup
.
array
()
.
array
()
.
transform
(
getEnvValue
)
.
transform
(
replaceQuotes
)
.
json
()
.
json
()
.
of
(
yup
.
string
<
WalletType
>
().
oneOf
(
SUPPORTED_WALLETS
));
.
of
(
yup
.
string
<
WalletType
>
().
oneOf
(
SUPPORTED_WALLETS
));
...
@@ -364,6 +364,9 @@ const schema = yup
...
@@ -364,6 +364,9 @@ const schema = yup
NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID
:
yup
.
string
(),
NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID
:
yup
.
string
(),
NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN
:
yup
.
string
(),
NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN
:
yup
.
string
(),
NEXT_PUBLIC_FAVICON_GENERATOR_API_KEY
:
yup
.
string
(),
NEXT_PUBLIC_FAVICON_GENERATOR_API_KEY
:
yup
.
string
(),
// Misc
NEXT_PUBLIC_USE_NEXT_JS_PROXY
:
yup
.
boolean
(),
})
})
.
concat
(
accountSchema
)
.
concat
(
accountSchema
)
.
concat
(
adsBannerSchema
)
.
concat
(
adsBannerSchema
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment