export default async function()

in tools/gsuite-scanner/src/scan.ts [18:50]


export default async function (config: IConfigSchema): Promise<IScanResult> {

    // ensure we have good configuration
    config = sanitizeConfig(config);

    startLogging(config);

    // create a function binding to get credentials when we need them
    const getCredentials = getCredentialsBinder(config);

    // load all sites
    const sites = await getSitesBinder(getCredentials)(config);

    const sitesWithSummary: ISiteWithContentSummary[] = [];

    // add content summary to all sites
    for (let i = 0; i < sites.length; i++) {
        const site = sites[i];
        const content = await getContentBinder(getCredentials)(config, site.siteName);
        sitesWithSummary.push(summarize(site, content));
    }

    const result = {
        sites: sitesWithSummary,
    };

    // now we need to output our stuff to the configured outputs
    writeOutput(config, result);

    endLogging();

    return result;
}