<commit_before>package au.gov.dva;


import au.gov.dva.sopref.exceptions.ConfigurationError;

public class AppSettings {

    private static final String envVarName = "DEP_ENV";

    public static Environment getEnvironment() {

        String envVarValue = System.getenv(envVarName);
        if (envVarValue == null)
        {
            throw new ConfigurationError(String.format("Environment variable %smust have value.", envVarName));
        }
        switch (envVarValue)
        {
            case "devtest" : return Environment.devtest;
            case "devtestlocal" : return Environment.devtestlocal;
            case "prod" : return Environment.prod;
            default: throw new ConfigurationError(String.format("Value for environment variable %smust be 'devtest','devtestlocal' or 'prod'", envVarValue));

        }

    }

    public static class AzureStorage {

        // todo: get production values from environment variables



        public static class DevTest {
            // For use with Azure storage emulator.
            public final static String accountName = "devstoreaccount1";
            public final static String accountKey = "<KEY>;
            public final static String storageConnectionString =  "UseDevelopmentStorage=true";
        }
    }

    public enum Environment {
        prod,
        devtest,
        devtestlocal
    }
}





<commit_msg>Set up AppSettings to provide appropriate Azure Storage Connection string depending on environment.<commit_after>package au.gov.dva;


import au.gov.dva.sopref.exceptions.ConfigurationError;

import static au.gov.dva.AppSettings.Environment.devtest;

public class AppSettings {

    private static final String envVarName = "DEP_ENV";


    public static Environment getEnvironment() {

        String envVarValue = System.getenv(envVarName);
        if (envVarValue == null)
        {
            throw new ConfigurationError(String.format("Environment variable %smust have value.", envVarName));
        }
        switch (envVarValue)
        {
            case "devtest" : return devtest;
            case "devtestlocal" : return Environment.devtestlocal;
            case "prod" : return Environment.prod;
            default: throw new ConfigurationError(String.format("Value for environment variable %smust be 'devtest','devtestlocal' or 'prod'", envVarValue));

        }
    }

    private static String getEnvVarValue(String envVarName)
    {
        String value = System.getenv(envVarName);
        if (value == null)
        {
            throw new ConfigurationError(String.format("Expecting value for environment variable: %s", envVarName));
        }
        return value;
    }

    public static class AzureStorage {

        // todo: get production values from environment variables

        private static final String AZURE_STORAGE_CONNECTION_STRING = "AZURE_STORAGE_CONNECTION_STRING";

        public static String getConnectionString() {
            switch (getEnvironment())
            {
                case devtestlocal: return DevTestLocal.storageConnectionString;
                case devtest: return getEnvVarValue(AZURE_STORAGE_CONNECTION_STRING);
                case prod: return getEnvVarValue(AZURE_STORAGE_CONNECTION_STRING);
                default: throw new ConfigurationError("Cannot get Azure connection string");
            }
        }



        private static class DevTestLocal {
            // For use with Azure storage emulator.
            public final static String accountName = "devstoreaccount1";
            public final static String accountKey = "<KEY>;
            public final static String storageConnectionString =  "UseDevelopmentStorage=true";
        }
    }

    public enum Environment {
        prod,
        devtest,
        devtestlocal
    }
}






{'fraction_non_alphanumeric': 0.07397691500524659, 'fraction_numerical': 0.0005246589716684155, 'mean_word_length': 2.4821917808219176, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6070449', 'n_tokens_mistral': 965, 'n_tokens_neox': 915, 'n_words': 275}