/// <summary> /// Get the full path of the local cache for the service config file, /// which is specified by Constant.ServiceConfigFileNameEnvVar. /// </summary> /// <returns>local cache folder path</returns> public static string GetServiceLocalCacheFullPath() { string path = SoaHelper.GetCcpPackageRoot(); if (string.IsNullOrEmpty(path)) { RuntimeTraceHelper.TraceEvent( TraceEventType.Error, SoaHelper.CreateTraceMessage( "Utility", "GetServiceLocalCacheFullPath", "The env var CCP_PACKAGE_ROOT has no value")); } else { if (Directory.Exists(path)) { string configFileName = Environment.GetEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar); if (string.IsNullOrEmpty(configFileName)) { RuntimeTraceHelper.TraceEvent( TraceEventType.Error, SoaHelper.CreateTraceMessage( "Utility", "GetServiceLocalCacheFullPath", "The env var CCP_SERVICE_CONFIG_FILENAME has no value")); } else { string subFolderName = Path.GetFileNameWithoutExtension(configFileName); string result = FindLatestSubDirectory(Path.Combine(path, subFolderName)); if (!string.IsNullOrEmpty(result) && Directory.Exists(result)) { return(result); } } } } // fall back to the home folder, which stores the build-in CcpEchoSvc and HpcSeviceHost.exe string home = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); RuntimeTraceHelper.TraceEvent( TraceEventType.Information, SoaHelper.CreateTraceMessage( "Utility", "GetServiceLocalCacheFullPath", string.Format(CultureInfo.InvariantCulture, "Fall back to the home folder {0}.", home))); return(home); }
/// <summary> /// Create a ServiceRegistrationRepo instance. /// </summary> /// <returns>ServiceRegistrationRepo instance</returns> private Task <ServiceRegistrationRepo> GetRegistrationRepo(string centrialPath) { if (SoaHelper.IsOnAzure()) { centrialPath = SoaHelper.GetCcpPackageRoot(); } else { if (string.IsNullOrEmpty(centrialPath)) { ThrowHelper.ThrowSessionFault(SOAFaultCode.ServiceRegistrationPathEnvironmentMissing, SR.ServiceRegistrationPathEnvironmentMissing); } } #if HPCPACK if (!BrokerLauncherEnvironment.Standalone) { client = this.context.GetServiceRegistrationRestClient(); } #endif return(Task.FromResult(new ServiceRegistrationRepo(centrialPath, null))); }