public async Task Run(XConsole xc) { try { using (var scope = xc.WebHost.Services.CreateScope()) { var settings = scope.ServiceProvider.GetService <IDbSettingsReader>(); xc.WriteInfo(this, "Retriving version information.."); var versions = new Versions() { AppVersion = settings.GetAppVersion(), DataSeederFrameworkVersion = settings.GetDataSeederFrameworkVersion(), FrameWorkVersion = AppSettingsAccessor.GetFrameWorkBuildNumber(true) }; xc.WriteSuccess(this, "Done."); var table = xc.CreateTable(new string[] { "Item", "Value" }); table.AddRow("Application Version", versions.AppVersion); table.AddRow("Data Seeder Framework Version", versions.DataSeederFrameworkVersion); table.AddRow("Framework Version", versions.FrameWorkVersion); var parts = versions.NugetVersion.Split('.'); table.AddRow("Nuget Version", parts.Length <= 3 ? versions.NugetVersion : string.Join('.', parts.Take(3))); xc.WriteTable(table); } } catch (Exception ex) { xc.WriteException(this, ex); } }
public ABaseController(IConfiguration config, IDbSettingsReader settings, ILogger logger) : base() { this.Settings = settings; this.Config = config; this.Views = new ViewNames(); this.Logger = logger; this.Controllers = new ControllerNames { DashboardController = Settings.GetAppDashboardControllerName(), MyProfileController = Settings.GetAppMyProfileControllerName(), AccountController = Settings.GetAccountControllerName(), UninstallController = Settings.GetAppUninstallControllerName() }; this.VersionInfo = new Versions() { AppVersion = settings.GetAppVersion(), FrameWorkVersion = AppSettingsAccessor.GetFrameWorkBuildNumber(), DataSeederFrameworkVersion = Settings.GetDataSeederFrameworkVersion() }; }
private static void SeedSettingsData(ExicoShopifyDbContext exicoDbContext, IConfiguration config, ILogger logger) { if (!exicoDbContext.SystemSettings.Any()) { SettingsSeederAppModel settSeed = new SettingsSeederAppModel(); config.Bind("SettingsSeed", settSeed); logger.LogInformation("Seeding settings data {@data}.", settSeed); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "Account", Description = "Default account controller name without the controller part.", DisplayName = "Account controller", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.ACCOUNT_CONTOLLER.ToString(), Value = settSeed.ACCOUNT_CONTOLLER ?? "Account" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "Dashboard", Description = "Default dashboard controller name without the controller part.", DisplayName = "Dashboard controller", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.DASHBOARD_CONTOLLER.ToString(), Value = settSeed.DASHBOARD_CONTOLLER ?? "Dashboard" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "MyProfile", Description = "Default my profile controller name without the controller part.", DisplayName = "My profile controller", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.MY_PROFILE_CONTOLLER.ToString(), Value = settSeed.MY_PROFILE_CONTOLLER ?? "MyProfile", }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "Shopify", Description = "Default my Shopify controller name without the controller part.", DisplayName = "Shopify controller", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.SHOPIFY_CONTROLLER.ToString(), Value = settSeed.SHOPIFY_CONTROLLER ?? "Shopify", }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "AppUninstall", Description = "Default my app uninstall controller name without the controller part.", DisplayName = "App uninstall controller", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.UNINSTALL_CONTROLLER.ToString(), Value = settSeed.UNINSTALL_CONTROLLER ?? "Uninstall", }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "127.0.0.1", Description = "List of privileged ip addresses.Use comma for multiples.", DisplayName = "Privileged IPs", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.PRIVILEGED_IPS.ToString(), Value = settSeed.PRIVILEGED_IPS ?? "127.0.0.1", }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "Welcome to the app!", Description = "A welcome message template for new users.It can contain HTML.", DisplayName = "Welcome Message", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.WELCOME_EMAIL_TEMPLATE.ToString(), Value = settSeed.WELCOME_EMAIL_TEMPLATE ?? "Welcome to the app!", }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "*****@*****.**", Description = "App support email address.", DisplayName = "Support Email", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.APP_SUPPORT_EMAIL_ADDRESS.ToString(), Value = settSeed.APP_SUPPORT_EMAIL_ADDRESS ?? "" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "shopiyfy ap key", Description = "API key of your shopify app.", DisplayName = "API Key", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.API_KEY.ToString(), Value = settSeed.API_KEY ?? "" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "exicoShopifyFramework", Description = "App name same as shopify app store.", DisplayName = "App Name", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.APP_NAME.ToString(), Value = settSeed.APP_NAME ?? "" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "https://*****:*****@myapp.com", Description = "Email address that will be used as from address.", DisplayName = "From Email", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.SHOPIFY_EMAILS_FROM_ADDRESS.ToString(), Value = settSeed.SHOPIFY_EMAILS_FROM_ADDRESS ?? "" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "*****@*****.**", Description = "Emaile address that will receive any emails generated by the app/framework.Use comma for multiples.", DisplayName = "Subscribers", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.SHOPIFY_EVENT_EMAIL_SUBSCRIBERS.ToString(), Value = settSeed.SHOPIFY_EVENT_EMAIL_SUBSCRIBERS ?? "" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "1.0.0", Description = "Version of your app", DisplayName = "Version", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.APP_VERSION.ToString(), Value = settSeed.APP_VERSION ?? "1.0.0" }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "0.0.0", Description = "Version of the Exico Shopify Framework that created this database", DisplayName = "Seeder Framework Version", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.SEEDER_FRAMEWORK_VERSION.ToString(), Value = AppSettingsAccessor.GetFrameWorkBuildNumber(true) }); exicoDbContext.SystemSettings.Add(new SystemSetting() { DefaultValue = "", Description = "Default auser password salt", DisplayName = "User Password Salt", GroupName = "CORE", SettingName = CORE_SYSTEM_SETTING_NAMES.PASSWORD_SALT.ToString(), Value = Guid.NewGuid().ToString() }); var total = exicoDbContext.SaveChanges(); logger.LogInformation($"Finished seeding settings data. Total {total} records."); } else { logger.LogInformation("Settings data alraedy exists.Skipping seeding for settings data."); } }