public IActionResult GetHealth()
        {
            _logger.Log(LogLevel.Trace, "Performing heartbeat");

            _metricService.Record(Metric.Version, _glasswallVersionService.GetVersion());

            return(Ok());
        }
예제 #2
0
        private string RebuildFile()
        {
            byte[] protectedFile = null;

            Console.WriteLine($"Using Glasswall Version: {_glasswallVersionService.GetVersion()}");

            var file = File.ReadAllBytes(_config.InputPath);

            var fileType = _fileTypeDetector.DetermineFileType(file);

            Console.WriteLine($"Filetype Detected for {_config.FileId}: {fileType.FileTypeName}");

            string status;

            if (fileType.FileType == FileType.Unknown)
            {
                status = FileOutcome.Unmodified;
            }
            else
            {
                var protectedFileResponse = _fileProtector.GetProtectedFile(GetDefaultContentManagement(), fileType.FileTypeName, file);

                if (!string.IsNullOrWhiteSpace(protectedFileResponse.ErrorMessage))
                {
                    if (protectedFileResponse.IsDisallowed)
                    {
                        status = FileOutcome.Unmodified;
                    }
                    else
                    {
                        status = FileOutcome.Failed;
                    }
                }
                else
                {
                    protectedFile = protectedFileResponse.ProtectedFile;
                    status        = FileOutcome.Replace;
                }
            }

            Directory.CreateDirectory("/output");

            File.WriteAllBytes(_config.OutputPath, protectedFile ?? file);

            Console.WriteLine($"Status of {status} for {_config.FileId}");

            return(status);
        }
예제 #3
0
        private void RecordEngineVersion()
        {
            var version = _glasswallVersionService.GetVersion();

            MetricService.Record(Metric.Version, version);
        }