示例#1
0
        private static string[] UpdateServerUrlCommandLineArgAfterSetupIfNecessary(
            string[] originalCommandLineArgs, string[] oldServerUrl, string newServerUrl)
        {
            if (string.IsNullOrEmpty(newServerUrl))
            {
                return(originalCommandLineArgs);
            }

            var idx = CommandLineConfigurationArgumentsHelper.FindIndexOfCliOptFor(
                originalCommandLineArgs, RavenConfiguration.GetKey(x => x.Core.ServerUrls));

            if (idx == -1)
            {
                return(originalCommandLineArgs);
            }

            var resultArgs = originalCommandLineArgs.ToArray();

            Uri.TryCreate(oldServerUrl[0], UriKind.Absolute, out var uriBeforeSetup);

            var newServerUrls = newServerUrl.Split(";");
            var uriBuilders   = new List <UriBuilder>();

            foreach (var nServerUrl in newServerUrls)
            {
                Uri.TryCreate(nServerUrl, UriKind.Absolute, out var uriAfterSetup);

                uriBuilders.Add(new UriBuilder(uriAfterSetup.Scheme, uriBeforeSetup.Host, uriBeforeSetup.Port));
            }

            resultArgs[idx] = $"--{RavenConfiguration.GetKey(x => x.Core.ServerUrls)}={string.Join(";", uriBuilders.Select(builder => UrlUtil.TrimTrailingSlash(builder.ToString())))}";

            return(resultArgs);
        }
示例#2
0
        private static string[] FilterOutArgByConfigurationKey(string[] args, string confKey)
        {
            var idx = CommandLineConfigurationArgumentsHelper.FindIndexOfCliOptFor(args, confKey);

            if (idx == -1)
            {
                return(args);
            }

            var result = args.ToList();

            result.RemoveAt(idx);
            return(result.ToArray());
        }
示例#3
0
        private static string[] FilterOutSetupModeArg(string[] args)
        {
            var idx = CommandLineConfigurationArgumentsHelper.FindIndexOfCliOptFor(args, RavenConfiguration.GetKey(x => x.Core.SetupMode));

            if (idx == -1)
            {
                return(args);
            }

            var result = args.ToList();

            result.RemoveAt(idx);
            return(result.ToArray());
        }