package xyz.wbsite.action.screen;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import xyz.wbsite.frame.base.Screen;
import xyz.wbsite.module.conf.ent.NginxCtrl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Home extends Screen {
    @Autowired
    private NginxCtrl nginxCtrl;
    @Value("${mapping.default.port}")
    private String serverPort;

    @Override
    public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
        model.addAttribute("run", nginxCtrl.isRunning() ? "true" : "false");
        model.addAttribute("serverPort", serverPort);
    }
}
