public ConfigurationParser(ConfigurationTypeEnum configurationType, string fileName = null) { _environmentVariableRepository = new EnvironmentVariableRepository( new EnvironmentVariableSource(), new FileVariableSource(configurationType, fileName), configurationType); }
public EnvironmentVariableRepository(IEnvironmentSource environmentSource, IEnvironmentSource fileSource, ConfigurationTypeEnum configurationType = ConfigurationTypeEnum.PreferEnvironment) { _environmentSource = environmentSource; _fileSource = fileSource; _configurationType = configurationType; }
public FileVariableSource(ConfigurationTypeEnum configurationType = ConfigurationTypeEnum.PreferEnvironment, string filename = null) { _configurationType = configurationType; if (filename != null) { ReadFile(filename); } }
public static T Parse <T>(string fileName, ConfigurationTypeEnum configurationTypeEnum) { var parser = new ConfigurationParser(new EnvironmentVariableRepository( new EnvironmentVariableSource(), new FileVariableSource(configurationTypeEnum, fileName), configurationTypeEnum)); return(parser.ParseConfiguration <T>()); }
public static T ParsePosix <T>(string fileName, ConfigurationTypeEnum configurationTypeEnum, Func <string, string, string> decryptHandler) { var parser = new ConfigurationParser(new EnvironmentVariableRepository( new EnvironmentVariableSource(), new FileVariableSource(configurationTypeEnum, fileName), configurationTypeEnum)); return(parser.ParseConfigurationPosix <T>(decryptHandler: decryptHandler, posix: true)); }
private static IWebHostBuilder ConfigureService <T>(IWebHostBuilder hostBuilder, string?fileName = null, ConfigurationTypeEnum configurationType = ConfigurationTypeEnum.PreferEnvironment) { return(hostBuilder.ConfigureServices(services => { var configurationParser = new ConfigurationParser(configurationType, fileName); var instance = configurationParser.ParseConfiguration <T>(); services.AddSingleton(typeof(T), instance); })); }
public ConfigurationItem([CallerMemberName] string propertyName = "ENV", bool required = true, bool ignore = false, bool encrypt = false, object? @default = null, ConfigurationTypeEnum configurationType = ConfigurationTypeEnum.Default, bool json = false) { Name = propertyName; Required = required; Ignore = ignore; Encrypt = encrypt; Default = @default; ConfigurationType = configurationType; Json = json; }
public SelectList getConfigTypes(int selected = 0) { var types = new ConfigurationTypeEnum[] { ConfigurationTypeEnum.Bool, ConfigurationTypeEnum.Image, ConfigurationTypeEnum.Int, ConfigurationTypeEnum.String }; var list = new List <SelectListItem>(); foreach (var m in types) { list.Add(new SelectListItem { Selected = (int)m == selected, Text = m.ToDescription(), Value = ((int)m).ToString(), }); } return(new SelectList(list, "Value", "Text")); }
/// <summary> /// Initializes a new instance of the <see cref="UpdateAppStoreApp" /> class. /// </summary> /// <param name="details">Details (required).</param> /// <param name="configurationType">Configuration type <example>External link</example><example>Flipdish hosted</example> (required).</param> /// <param name="storeSelectorType">Store selector type (required).</param> /// <param name="fieldGroups">Field groups.</param> /// <param name="setupInstructions">Setup instructions.</param> /// <param name="externalSetupLink">External setup link.</param> /// <param name="teammateAppAccessLevel">Teammate app access level.</param> /// <param name="permissionsType">Permissions type (required).</param> /// <param name="support">Support information.</param> /// <param name="name">Name (required).</param> /// <param name="description">Description (required).</param> /// <param name="isEnabled">Is application enabled.</param> /// <param name="categories">Categories (required).</param> /// <param name="countries">Countries (required).</param> /// <param name="developerName">Developer Name.</param> public UpdateAppStoreApp(string details = default(string), ConfigurationTypeEnum configurationType = default(ConfigurationTypeEnum), StoreSelectorTypeEnum storeSelectorType = default(StoreSelectorTypeEnum), List <FieldGroup> fieldGroups = default(List <FieldGroup>), string setupInstructions = default(string), string externalSetupLink = default(string), TeammateAppAccessLevelEnum?teammateAppAccessLevel = default(TeammateAppAccessLevelEnum?), PermissionsTypeEnum permissionsType = default(PermissionsTypeEnum), AppStoreAppSupportInfo support = default(AppStoreAppSupportInfo), string name = default(string), string description = default(string), bool?isEnabled = default(bool?), List <CategoriesEnum> categories = default(List <CategoriesEnum>), List <CountriesEnum> countries = default(List <CountriesEnum>), string developerName = default(string)) { // to ensure "details" is required (not null) if (details == null) { throw new InvalidDataException("details is a required property for UpdateAppStoreApp and cannot be null"); } else { this.Details = details; } // to ensure "configurationType" is required (not null) if (configurationType == null) { throw new InvalidDataException("configurationType is a required property for UpdateAppStoreApp and cannot be null"); } else { this.ConfigurationType = configurationType; } // to ensure "storeSelectorType" is required (not null) if (storeSelectorType == null) { throw new InvalidDataException("storeSelectorType is a required property for UpdateAppStoreApp and cannot be null"); } else { this.StoreSelectorType = storeSelectorType; } // to ensure "permissionsType" is required (not null) if (permissionsType == null) { throw new InvalidDataException("permissionsType is a required property for UpdateAppStoreApp and cannot be null"); } else { this.PermissionsType = permissionsType; } // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for UpdateAppStoreApp and cannot be null"); } else { this.Name = name; } // to ensure "description" is required (not null) if (description == null) { throw new InvalidDataException("description is a required property for UpdateAppStoreApp and cannot be null"); } else { this.Description = description; } // to ensure "categories" is required (not null) if (categories == null) { throw new InvalidDataException("categories is a required property for UpdateAppStoreApp and cannot be null"); } else { this.Categories = categories; } // to ensure "countries" is required (not null) if (countries == null) { throw new InvalidDataException("countries is a required property for UpdateAppStoreApp and cannot be null"); } else { this.Countries = countries; } this.FieldGroups = fieldGroups; this.SetupInstructions = setupInstructions; this.ExternalSetupLink = externalSetupLink; this.TeammateAppAccessLevel = teammateAppAccessLevel; this.Support = support; this.IsEnabled = isEnabled; this.DeveloperName = developerName; }
/// <summary> /// Initializes a new instance of the <see cref="AppDetail" /> class. /// </summary> /// <param name="id">Integration Public Id (required).</param> /// <param name="configurationType">Configuration Type <example>ExternalLink</example><example>FlipdishHosted</example> (required).</param> /// <param name="storeSelectorType">Store Selector Type (required).</param> /// <param name="fieldGroups">Field Groups.</param> /// <param name="setupInstructions">Setup Instructions.</param> /// <param name="externalSetupLink">External Setup Link.</param> /// <param name="oAuthAppId">OAuth App Id (required).</param> /// <param name="teammateAppAccessLevel">Teammate App Access Level.</param> /// <param name="permissionsType">Permissions Type (required).</param> /// <param name="name">Name (required).</param> /// <param name="description">Description (required).</param> /// <param name="logo">Logo.</param> /// <param name="isEnabled">Is application enabled.</param> /// <param name="verificationStatus">Application verification status (required).</param> /// <param name="tags">Tags (required).</param> /// <param name="regions">Regions (required).</param> /// <param name="developerName">Developer Name.</param> public AppDetail(string id = default(string), ConfigurationTypeEnum configurationType = default(ConfigurationTypeEnum), StoreSelectorTypeEnum storeSelectorType = default(StoreSelectorTypeEnum), List <FieldGroup> fieldGroups = default(List <FieldGroup>), string setupInstructions = default(string), string externalSetupLink = default(string), string oAuthAppId = default(string), TeammateAppAccessLevelEnum?teammateAppAccessLevel = default(TeammateAppAccessLevelEnum?), PermissionsTypeEnum permissionsType = default(PermissionsTypeEnum), string name = default(string), string description = default(string), string logo = default(string), bool?isEnabled = default(bool?), VerificationStatusEnum verificationStatus = default(VerificationStatusEnum), List <string> tags = default(List <string>), List <string> regions = default(List <string>), string developerName = default(string)) { // to ensure "id" is required (not null) if (id == null) { throw new InvalidDataException("id is a required property for AppDetail and cannot be null"); } else { this.Id = id; } // to ensure "configurationType" is required (not null) if (configurationType == null) { throw new InvalidDataException("configurationType is a required property for AppDetail and cannot be null"); } else { this.ConfigurationType = configurationType; } // to ensure "storeSelectorType" is required (not null) if (storeSelectorType == null) { throw new InvalidDataException("storeSelectorType is a required property for AppDetail and cannot be null"); } else { this.StoreSelectorType = storeSelectorType; } // to ensure "oAuthAppId" is required (not null) if (oAuthAppId == null) { throw new InvalidDataException("oAuthAppId is a required property for AppDetail and cannot be null"); } else { this.OAuthAppId = oAuthAppId; } // to ensure "permissionsType" is required (not null) if (permissionsType == null) { throw new InvalidDataException("permissionsType is a required property for AppDetail and cannot be null"); } else { this.PermissionsType = permissionsType; } // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for AppDetail and cannot be null"); } else { this.Name = name; } // to ensure "description" is required (not null) if (description == null) { throw new InvalidDataException("description is a required property for AppDetail and cannot be null"); } else { this.Description = description; } // to ensure "verificationStatus" is required (not null) if (verificationStatus == null) { throw new InvalidDataException("verificationStatus is a required property for AppDetail and cannot be null"); } else { this.VerificationStatus = verificationStatus; } // to ensure "tags" is required (not null) if (tags == null) { throw new InvalidDataException("tags is a required property for AppDetail and cannot be null"); } else { this.Tags = tags; } // to ensure "regions" is required (not null) if (regions == null) { throw new InvalidDataException("regions is a required property for AppDetail and cannot be null"); } else { this.Regions = regions; } this.FieldGroups = fieldGroups; this.SetupInstructions = setupInstructions; this.ExternalSetupLink = externalSetupLink; this.TeammateAppAccessLevel = teammateAppAccessLevel; this.Logo = logo; this.IsEnabled = isEnabled; this.DeveloperName = developerName; }
public FileVariableSource() { _configurationType = ConfigurationTypeEnum.PreferEnvironment; }
/// <summary> /// Initializes a new instance of the <see cref="AppStoreAppConfiguration" /> class. /// </summary> /// <param name="id">Unique App store app configuration id (required).</param> /// <param name="appId">App id (required).</param> /// <param name="appStoreAppId">App store app id (required).</param> /// <param name="isEnabled">Is enabled (required).</param> /// <param name="storeIds">Stores id's.</param> /// <param name="settings">Settings.</param> /// <param name="verificationStatus">Application verification status (required).</param> /// <param name="logo">Logo.</param> /// <param name="oAuthAppId">OAuth App identifier (required).</param> /// <param name="details">Details (required).</param> /// <param name="configurationType">Configuration type <example>External link</example><example>Flipdish hosted</example> (required).</param> /// <param name="storeSelectorType">Store selector type (required).</param> /// <param name="fieldGroups">Field groups.</param> /// <param name="setupInstructions">Setup instructions.</param> /// <param name="externalSetupLink">External setup link.</param> /// <param name="teammateAppAccessLevel">Teammate app access level.</param> /// <param name="permissionsType">Permissions type (required).</param> /// <param name="support">Support information.</param> /// <param name="name">Name (required).</param> /// <param name="description">Description (required).</param> /// <param name="categories">Categories (required).</param> /// <param name="countries">Countries (required).</param> /// <param name="developerName">Developer Name.</param> public AppStoreAppConfiguration(string id = default(string), string appId = default(string), string appStoreAppId = default(string), bool?isEnabled = default(bool?), List <int?> storeIds = default(List <int?>), List <Setting> settings = default(List <Setting>), VerificationStatusEnum verificationStatus = default(VerificationStatusEnum), string logo = default(string), string oAuthAppId = default(string), string details = default(string), ConfigurationTypeEnum configurationType = default(ConfigurationTypeEnum), StoreSelectorTypeEnum storeSelectorType = default(StoreSelectorTypeEnum), List <FieldGroup> fieldGroups = default(List <FieldGroup>), string setupInstructions = default(string), string externalSetupLink = default(string), TeammateAppAccessLevelEnum?teammateAppAccessLevel = default(TeammateAppAccessLevelEnum?), PermissionsTypeEnum permissionsType = default(PermissionsTypeEnum), AppStoreAppSupportInfo support = default(AppStoreAppSupportInfo), string name = default(string), string description = default(string), List <CategoriesEnum> categories = default(List <CategoriesEnum>), List <CountriesEnum> countries = default(List <CountriesEnum>), string developerName = default(string)) { // to ensure "id" is required (not null) if (id == null) { throw new InvalidDataException("id is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.Id = id; } // to ensure "appId" is required (not null) if (appId == null) { throw new InvalidDataException("appId is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.AppId = appId; } // to ensure "appStoreAppId" is required (not null) if (appStoreAppId == null) { throw new InvalidDataException("appStoreAppId is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.AppStoreAppId = appStoreAppId; } // to ensure "isEnabled" is required (not null) if (isEnabled == null) { throw new InvalidDataException("isEnabled is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.IsEnabled = isEnabled; } // to ensure "verificationStatus" is required (not null) if (verificationStatus == null) { throw new InvalidDataException("verificationStatus is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.VerificationStatus = verificationStatus; } // to ensure "oAuthAppId" is required (not null) if (oAuthAppId == null) { throw new InvalidDataException("oAuthAppId is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.OAuthAppId = oAuthAppId; } // to ensure "details" is required (not null) if (details == null) { throw new InvalidDataException("details is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.Details = details; } // to ensure "configurationType" is required (not null) if (configurationType == null) { throw new InvalidDataException("configurationType is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.ConfigurationType = configurationType; } // to ensure "storeSelectorType" is required (not null) if (storeSelectorType == null) { throw new InvalidDataException("storeSelectorType is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.StoreSelectorType = storeSelectorType; } // to ensure "permissionsType" is required (not null) if (permissionsType == null) { throw new InvalidDataException("permissionsType is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.PermissionsType = permissionsType; } // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.Name = name; } // to ensure "description" is required (not null) if (description == null) { throw new InvalidDataException("description is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.Description = description; } // to ensure "categories" is required (not null) if (categories == null) { throw new InvalidDataException("categories is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.Categories = categories; } // to ensure "countries" is required (not null) if (countries == null) { throw new InvalidDataException("countries is a required property for AppStoreAppConfiguration and cannot be null"); } else { this.Countries = countries; } this.StoreIds = storeIds; this.Settings = settings; this.Logo = logo; this.FieldGroups = fieldGroups; this.SetupInstructions = setupInstructions; this.ExternalSetupLink = externalSetupLink; this.TeammateAppAccessLevel = teammateAppAccessLevel; this.Support = support; this.DeveloperName = developerName; }
public static IWebHostBuilder UseEnvironmentConfiguration <T>(this IWebHostBuilder hostBuilder, string?fileName, ConfigurationTypeEnum configurationTypeEnum = ConfigurationTypeEnum.PreferEnvironment) where T : class { return(ConfigureService <T>(hostBuilder, fileName, configurationTypeEnum)); }
public FileVariableSource(ConfigurationTypeEnum configurationType = ConfigurationTypeEnum.PreferEnvironment, string?filename = null) { _configurationType = configurationType; if (filename is {})
public void SetConfigurationType(ConfigurationTypeEnum configurationTypeEnum) { _configurationType = configurationTypeEnum; }