import grabTurboCiConfig from "@/src/utils/grab-turboci-config";
import cronCheckServicesHealtcheck from "./healthcheck";
import cronCheckServicesGit from "./git";

export default async function cronCheckServices() {
    const config = grabTurboCiConfig();

    for (let i = 0; i < config.services.length; i++) {
        const service = config.services[i];

        if (!service.servers) {
            continue;
        }

        await cronCheckServicesGit({ deployment: config, service });

        for (let srv = 0; srv < service.servers.length; srv++) {
            const server = service.servers[srv];
            await cronCheckServicesHealtcheck({ config, server, service });
        }
    }
}
