Exemple #1
0
 private static void SetHost(ApplicationStatus status)
 {
     if (File.Exists("/etc/hostname"))
     {
         status.Host = File.ReadAllText("/etc/hostname");
     }
 }
Exemple #2
0
 DefaultAppStatusService()
 {
     _status = new ApplicationStatus
     {
         StatusProviderVersion = typeof(DefaultAppStatusService).Assembly.GetName().Version?.ToString() ?? "[not specified]"
     };
 }
Exemple #3
0
        private static void SetName(ApplicationStatus status)
        {
            Assembly entryAssembly = Assembly.GetEntryAssembly();

            if (entryAssembly != null)
            {
                status.Name = entryAssembly.GetName().Name;
            }
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of <see cref="ApplicationStatus"/>
        /// </summary>
        public ApplicationStatus(ApplicationStatus origin)
        {
            Name    = origin.Name;
            Version = origin.Version;
            StartAt = origin.StartAt;
            Host    = origin.Host;
            StatusProviderVersion = origin.StatusProviderVersion;

            SubStatuses = origin.SubStatuses.ToDictionary(
                ss => ss.Key,
                ss => (ICloneable)ss.Value.Clone());
        }
Exemple #5
0
        private static void SetVersion(ApplicationStatus status)
        {
            var envVer = Environment.GetEnvironmentVariable("APP_VERSION");

            if (string.IsNullOrWhiteSpace(envVer))
            {
                Assembly entryAssembly = Assembly.GetEntryAssembly();
                if (entryAssembly != null)
                {
                    status.Version = entryAssembly.GetName().Version.ToString();
                }
            }
            else
            {
                status.Version = envVer;
            }
        }