1- import { Context , Env , WebConfig , MobileConfig } from '../types.js'
1+ import { Context , Env , WebConfig , MobileConfig , basicAuth } from '../types.js'
22import constants from './constants.js'
33import { version } from '../../package.json'
44import { validateConfig } from './schemaValidation.js'
@@ -11,6 +11,7 @@ export default (options: Record<string, string>): Context => {
1111 let env : Env = getEnv ( ) ;
1212 let webConfig : WebConfig ;
1313 let mobileConfig : MobileConfig ;
14+ let basicAuthObj : basicAuth
1415 let config = constants . DEFAULT_CONFIG ;
1516 let port : number ;
1617 let resolutionOff : boolean ;
@@ -52,10 +53,13 @@ export default (options: Record<string, string>): Context => {
5253 if ( config . mobile ) {
5354 mobileConfig = {
5455 devices : config . mobile . devices ,
55- fullPage : config . mobile . fullPage || true ,
56+ fullPage : config . mobile . fullPage ?? true ,
5657 orientation : config . mobile . orientation || constants . MOBILE_ORIENTATION_PORTRAIT ,
5758 }
5859 }
60+ if ( config . basicAuthorization ) {
61+ basicAuthObj = config . basicAuthorization
62+ }
5963
6064 return {
6165 env : env ,
@@ -69,7 +73,8 @@ export default (options: Record<string, string>): Context => {
6973 enableJavaScript : config . enableJavaScript || false ,
7074 cliEnableJavaScript : config . cliEnableJavaScript || true ,
7175 scrollTime : config . scrollTime || constants . DEFAULT_SCROLL_TIME ,
72- allowedHostnames : config . allowedHostnames || [ ]
76+ allowedHostnames : config . allowedHostnames || [ ] ,
77+ basicAuthorization : basicAuthObj
7378 } ,
7479 uploadFilePath : '' ,
7580 webStaticConfig : [ ] ,
0 commit comments