public DesignDocumentIndexation(DBConfiguration profile, string apiPassword, string designDocumentName, string dbEnvironmentName, bool isTemporal, bool debug = false) { //for main check Succeeded = false; //Set design document name DesignDocumentName = designDocumentName; APIPassword = apiPassword; Profile = profile; //Set is Live and is temporal DBEnvironmentName = dbEnvironmentName; IsTemporal = isTemporal; //Set url to call if (!IsTemporal) { DesignDocumentURL = profile.GetDesignDocumentURL(DBEnvironmentName, DesignDocumentName); } else { DesignDocumentURL = profile.GetDesignDocumentURL(DBEnvironmentName, TemporalDesignDocumentName); } //Start the indexation! Start(); }
public static void Update(DBConfiguration model) { DBConfiguration oldModel = Settings.Databases.Where(x => x.Name == model.Name).FirstOrDefault(); if (oldModel != null) { Settings.Databases.Remove(oldModel); } Settings.Databases.Add(model); Save(); }
/// <summary> /// Creates an Database Profile /// </summary> public static void CreateProfile() { DBConfiguration profile = new DBConfiguration(); profile.Name = InputHelper.RequestInput("Profile Name: "); //profile.LiveUsername = InputHelper.RequestInput("Live Account (Username): "); //profile.LiveAPIKey = InputHelper.RequestInput("Live API Key: "); //profile.LiveAPIPassword = InputHelper.RequestInput("Live API Password: "******"Live URL (without db): ", "https://" + profile.LiveUsername + ".cloudant.com/"); //profile.LocalURL = InputHelper.RequestInput("Local URL (without db): ", "http://localhost:5984/"); ////config.ViewNames //Security Checks if (SettingManager.Settings.Databases.Where(x => x.Name.Equals(profile.Name, StringComparison.InvariantCultureIgnoreCase)).Count() > 0) { Console.WriteLine("There already exists an profile with the name: " + profile.Name); Console.WriteLine("Do you want to override it? ( Y/N )"); ConsoleKeyInfo anwser = Console.ReadKey(true); if (anwser.KeyChar == 'y') { //Override!!! SettingManager.Update(profile); //Load Profile. DBManager = new DatabaseManager(profile); return; } else { Console.WriteLine("Create aborted!"); return; } //END OF THIS OPTION. (We don't want to save double!) } else if (String.IsNullOrEmpty(profile.Name)) { Console.WriteLine("Database name can't be empty!"); return; } //Add the new configuration SettingManager.Settings.Databases.Add(profile); //Load Profile. DBManager = new DatabaseManager(profile); //Save the configuration to the file. SettingManager.Save(); Console.WriteLine("Profile \"" + profile.Name + "\" Saved and Loaded!"); Console.WriteLine("Please call /add-env to add environments to this profile!"); }
public DatabaseManager(DBConfiguration profile) { Profile = profile; }