Skip to content

Commit

Permalink
chore: styles changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpop-zengenti committed Feb 5, 2024
1 parent 29a1650 commit f67a28f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ private void SetContextValues(HttpRequest request, Activity? activity)

private RouteInfo TryToCreateIisFallbackRouteInfo(HttpContext context, Headers headers)
{
if (!string.IsNullOrWhiteSpace(_requestContext.IisHostname) && ! string.IsNullOrWhiteSpace(_requestContext.LoadBalancerVip))
if (!string.IsNullOrWhiteSpace(_requestContext.IisHostname) &&
!string.IsNullOrWhiteSpace(_requestContext.LoadBalancerVip))
{
return _routeInfoFactory.CreateForIisFallback(
context.Request.GetOriginUri(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public interface IRequestContext
public string RendererConfig { get; }

public string ProxyConfig { get; }

public string IisHostname { get; }

public string LoadBalancerVip { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Block
public string? Id { get; set; }

public Uri? BaseUri { get; set; }

public bool? EnableFullUriRouting { get; set; }

public List<string> StaticPaths { get; set; } = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class SiteConfig
public string Alias { get; set; } = null!;

public string ProjectApiId { get; set; } = null!;

public string? IisHostname { get; set; }

public string? PodIngressIp { get; set; }

public string? AccessToken { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ProgramOptions()

[Option("project-api-id", HelpText = "The API id of the project for the site config.")]
public string? ProjectApiId { get; init; }

[Option("access-token", HelpText = "The access token for the site config.")]
public string? AccessToken { get; init; }

Expand All @@ -48,10 +48,10 @@ public ProgramOptions()

[Option("iis-hostname", HelpText = "The IIS hostname for the site config.")]
public string? IisHostname { get; init; }
[Option("pod-cluster-id", HelpText = "The pod cluster id", Default = null)]

[Option("pod-cluster-id", HelpText = "The pod cluster id", Default = "hq")]
public string? PodClusterId { get; set; } = null!;

[Option("block-cluster-ingress-ip", HelpText = "The ingress IP for the block cluster", Default = null)]
public string? BlockClusterIngressIp { get; set; } = null!;

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class HttpPublishingApi : IPublishingApi
private readonly RestClient _internalRestClient;
private SiteConfig _siteConfig;
private readonly IRequestContext _requestContext;
private ILogger<HttpPublishingApi> _logger;
private readonly ILogger<HttpPublishingApi> _logger;

private SiteConfig SiteConfig
{
Expand Down Expand Up @@ -60,7 +60,6 @@ public HttpPublishingApi(
// new RestClientFactory($"http://localhost:5000/")
// .SecuredRestClient(new InternalSecurityTokenProvider(securityTokenParams));
// _internalRestClient.AddHeader("x-alias", securityTokenParams.Alias);

}

public async Task<BlockVersionInfo?> GetBlockVersionInfo(Guid versionId)
Expand All @@ -82,14 +81,14 @@ public HttpPublishingApi(
_logger.LogWarning("Could not find block version with id {Id} in site config", blockId);
return null;
}

var blockVersionInfo = new BlockVersionInfo(
_requestContext.ProjectUuid,
blockId,
versionId,
block.BaseUri,

Check warning on line 89 in src/Zengenti.Contensis.RequestHandler.LocalDevelopment/Services/HttpPublishingApi.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'baseUri' in 'BlockVersionInfo.BlockVersionInfo(Guid projectUuid, string blockId, Guid blockVersionId, Uri baseUri, string branch, bool enableFullUriRouting, IEnumerable<string>? staticPaths = null, int? versionNo = null)'.

Check warning on line 89 in src/Zengenti.Contensis.RequestHandler.LocalDevelopment/Services/HttpPublishingApi.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'baseUri' in 'BlockVersionInfo.BlockVersionInfo(Guid projectUuid, string blockId, Guid blockVersionId, Uri baseUri, string branch, bool enableFullUriRouting, IEnumerable<string>? staticPaths = null, int? versionNo = null)'.

Check warning on line 89 in src/Zengenti.Contensis.RequestHandler.LocalDevelopment/Services/HttpPublishingApi.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'baseUri' in 'BlockVersionInfo.BlockVersionInfo(Guid projectUuid, string blockId, Guid blockVersionId, Uri baseUri, string branch, bool enableFullUriRouting, IEnumerable<string>? staticPaths = null, int? versionNo = null)'.

Check warning on line 89 in src/Zengenti.Contensis.RequestHandler.LocalDevelopment/Services/HttpPublishingApi.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'baseUri' in 'BlockVersionInfo.BlockVersionInfo(Guid projectUuid, string blockId, Guid blockVersionId, Uri baseUri, string branch, bool enableFullUriRouting, IEnumerable<string>? staticPaths = null, int? versionNo = null)'.
block.Branch,
block.EnableFullUriRouting??false,
block.EnableFullUriRouting ?? false,
block.StaticPaths,
block.VersionNo);
return blockVersionInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public LocalNodeService(
}

_internalRestClient.AddHeader(Constants.Headers.IsLocalRequestHandler, "true");
var restManagementNode = (await _internalRestClient.GetAsync<dynamic>(
$"api/management/projects/{_siteConfigLoader.SiteConfig.ProjectApiId}/nodes/{path.Trim('/')}"))
var requestUrl =
$"api/management/projects/{_siteConfigLoader.SiteConfig.ProjectApiId}/nodes/{path.Trim('/')}";
var restManagementNode = (await _internalRestClient.GetAsync<dynamic>(requestUrl))
.ResponseObject;

if (restManagementNode == null)
Expand Down
24 changes: 17 additions & 7 deletions src/Zengenti.Contensis.RequestHandler.LocalDevelopment/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,25 @@ public void ConfigureServices(IServiceCollection services)
}
else
{
var podIngressIpDictionary = new Dictionary<string, string>()
var podIngressIpDictionary = new Dictionary<string, string>
{
{"local", "127.0.0.1" },
{"hq", "185.18.139.20" },
{"hq2", "185.18.139.242" },
{"lon", "185.18.139.108" },
{"man", "185.18.139.88" },
{
"local", "127.0.0.1"
},
{
"hq", "185.18.139.20"
},
{
"hq2", "185.18.139.242"
},
{
"lon", "185.18.139.108"
},
{
"man", "185.18.139.88"
},
};

siteConfigLoader = new SiteConfigLoader(
ProgramOptions.Current.Alias!,
ProgramOptions.Current.ProjectApiId!,
Expand Down

0 comments on commit f67a28f

Please sign in to comment.