diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs b/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs index d1eb0ec4..9dbf7fc3 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs @@ -33,7 +33,8 @@ namespace WebsitePanel.SchedulerServiceInstaller [CustomAction] public static ActionResult FinalizeInstall(Session session) { - ChangeConnectionString(session["CONNECTIONSTRING"], session["INSTALLFOLDER"]); + ChangeConfigString("installer.connectionstring", session["CONNECTIONSTRING"], session["INSTALLFOLDER"]); + ChangeCryptoKey(session["INSTALLFOLDER"]); InstallService(session["INSTALLFOLDER"]); return ActionResult.Success; @@ -55,7 +56,26 @@ namespace WebsitePanel.SchedulerServiceInstaller } } - private static void ChangeConnectionString(string connectionString, string installFolder) + private static void ChangeCryptoKey(string installFolder) + { + string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config"); + string cryptoKey = "0123456789"; + + if (File.Exists(path)) + { + using (var reader = new StreamReader(path)) + { + string content = reader.ReadToEnd(); + var pattern = new Regex(@"(?<=)"); + Match match = pattern.Match(content); + cryptoKey = match.Value; + } + } + + ChangeConfigString("installer.cryptokey", cryptoKey, installFolder); + } + + private static void ChangeConfigString(string searchString, string replaceValue, string installFolder) { string content; string path = Path.Combine(installFolder, "WebsitePanel.SchedulerService.exe.config"); @@ -65,8 +85,8 @@ namespace WebsitePanel.SchedulerServiceInstaller content = reader.ReadToEnd(); } - var re = new Regex("\\$\\{" + "installer.connectionstring" + "\\}+", RegexOptions.IgnoreCase); - content = re.Replace(content, connectionString); + var re = new Regex("\\$\\{" + searchString + "\\}+", RegexOptions.IgnoreCase); + content = re.Replace(content, replaceValue); using (var writer = new StreamWriter(path)) { diff --git a/WebsitePanel/Sources/WebsitePanel.SchedulerService/app.config b/WebsitePanel/Sources/WebsitePanel.SchedulerService/app.config index dff21e15..f4df3fb3 100644 --- a/WebsitePanel/Sources/WebsitePanel.SchedulerService/app.config +++ b/WebsitePanel/Sources/WebsitePanel.SchedulerService/app.config @@ -6,4 +6,10 @@ + + + + + + diff --git a/WebsitePanel/build.xml b/WebsitePanel/build.xml index 23b5e96e..d5d3bf4b 100644 --- a/WebsitePanel/build.xml +++ b/WebsitePanel/build.xml @@ -327,6 +327,7 @@ +