<commit_before>﻿using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure;
using SFA.DAS.Configuration.AzureTableStorage;

namespace SFA.DAS.Configuration
{
    public static class ConfigurationHelper
    {
        public static Environment CurrentEnvironment
        {
            get
            {
                switch (CurrentEnvironmentName)
                {
                    case "LOCAL": return Environment.Local;
                    case "AT": return Environment.At;
                    case "TEST": return Environment.Test;
                    case "PROD": return Environment.Prod;
                    case "MO": return Environment.Mo;
                    case "DEMO": return Environment.Demo;
                    default: return Environment.Unknown;
                }
            }
        }

        private static string CurrentEnvironmentName
        {
            get
            {
                var environmentName = System.Environment.GetEnvironmentVariable("DASENV");

                if (string.IsNullOrEmpty(environmentName))
                {
                    environmentName = CloudConfigurationManager.GetSetting("EnvironmentName");
                }

                return environmentName.ToUpperInvariant();
            }
        }

        public static T GetConfiguration<T>(string serviceName)
        {
            var configurationService = CreateConfigurationService(serviceName);
            var result = configurationService.Get<T>();
            return result;
        }

        public static Task<T> GetConfigurationAsync<T>(string serviceName)
        {<commit_msg>Removed needless split of variable assignment and return<commit_after>﻿using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure;
using SFA.DAS.Configuration.AzureTableStorage;

namespace SFA.DAS.Configuration
{
    public static class ConfigurationHelper
    {
        public static Environment CurrentEnvironment
        {
            get
            {
                switch (CurrentEnvironmentName)
                {
                    case "LOCAL": return Environment.Local;
                    case "AT": return Environment.At;
                    case "TEST": return Environment.Test;
                    case "PROD": return Environment.Prod;
                    case "MO": return Environment.Mo;
                    case "DEMO": return Environment.Demo;
                    default: return Environment.Unknown;
                }
            }
        }

        private static string CurrentEnvironmentName
        {
            get
            {
                var environmentName = System.Environment.GetEnvironmentVariable("DASENV");

                if (string.IsNullOrEmpty(environmentName))
                {
                    environmentName = CloudConfigurationManager.GetSetting("EnvironmentName");
                }

                return environmentName.ToUpperInvariant();
            }
        }

        public static T GetConfiguration<T>(string serviceName)
        {
            var configurationService = CreateConfigurationService(serviceName);
            return configurationService.Get<T>();
        }

        public static Task<T> GetConfigurationAsync<T>(string serviceName)
        {
{'fraction_non_alphanumeric': 0.06993865030674846, 'fraction_numerical': 0.0, 'mean_word_length': 1.6469155844155845, 'pattern_counts': {'":': 12, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3100389', 'n_tokens_mistral': 717, 'n_tokens_neox': 678, 'n_words': 164}