using System.Diagnostics;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using bitforum.Models;

namespace bitforum.Controllers.System
{
    [Authorize]
    [Route("System")]
    public class EnvsController : Controller
    {
        private readonly ILogger<EnvsController> _logger;
        private readonly IHostEnvironment _env;

        public EnvsController(ILogger<EnvsController> logger, IHostEnvironment env)
        {
            _logger = logger;
            _env = env;
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        [HttpGet("Envs")]
        public IActionResult Index()
        {
            ViewBag.EnvVars = Environment.GetEnvironmentVariables(); ;

            return View("~/Views/System/Envs.cshtml");
        }
    }
}
