mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:42:50 +08:00
#296 renamed configuration.json to ocelot.json in preparation
This commit is contained in:
parent
b46ef1945d
commit
cbaa2c3096
2
.gitignore
vendored
2
.gitignore
vendored
@ -243,7 +243,7 @@ tools/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# Ocelot acceptance test config
|
# Ocelot acceptance test config
|
||||||
test/Ocelot.AcceptanceTests/configuration.json
|
test/Ocelot.AcceptanceTests/ocelot.json
|
||||||
|
|
||||||
# Read the docstates
|
# Read the docstates
|
||||||
_build/
|
_build/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Configuration
|
Configuration
|
||||||
============
|
============
|
||||||
|
|
||||||
An example configuration can be found `here <https://github.com/TomPallister/Ocelot/blob/develop/test/Ocelot.ManualTest/configuration.json>`_.
|
An example configuration can be found `here <https://github.com/TomPallister/Ocelot/blob/develop/test/Ocelot.ManualTest/ocelot.json>`_.
|
||||||
There are two sections to the configuration. An array of ReRoutes and a GlobalConfiguration.
|
There are two sections to the configuration. An array of ReRoutes and a GlobalConfiguration.
|
||||||
The ReRoutes are the objects that tell Ocelot how to treat an upstream request. The Global
|
The ReRoutes are the objects that tell Ocelot how to treat an upstream request. The Global
|
||||||
configuration is a bit hacky and allows overrides of ReRoute specific settings. It's useful
|
configuration is a bit hacky and allows overrides of ReRoute specific settings. It's useful
|
||||||
@ -99,12 +99,12 @@ to you
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddJsonFile($"configuration.{hostingContext.HostingEnvironment.EnvironmentName}.json")
|
.AddJsonFile($"configuration.{hostingContext.HostingEnvironment.EnvironmentName}.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
|
|
||||||
Ocelot should now use the environment specific configuration and fall back to configuration.json if there isnt one.
|
Ocelot should now use the environment specific configuration and fall back to ocelot.json if there isnt one.
|
||||||
|
|
||||||
You also need to set the corresponding environment variable which is ASPNETCORE_ENVIRONMENT. More info on this can be found in the `asp.net core docs <https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments>`_.
|
You also need to set the corresponding environment variable which is ASPNETCORE_ENVIRONMENT. More info on this can be found in the `asp.net core docs <https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments>`_.
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ If you add the following when you register your services Ocelot will attempt to
|
|||||||
.AddOcelot()
|
.AddOcelot()
|
||||||
.AddStoreOcelotConfigurationInConsul();
|
.AddStoreOcelotConfigurationInConsul();
|
||||||
|
|
||||||
You also need to add the following to your configuration.json. This is how Ocelot
|
You also need to add the following to your ocelot.json. This is how Ocelot
|
||||||
finds your Consul agent and interacts to load and store the configuration from Consul.
|
finds your Consul agent and interacts to load and store the configuration from Consul.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
@ -40,7 +40,7 @@ Or transient as below...
|
|||||||
.AddTransientDelegatingHandler<FakeHandlerTwo>()
|
.AddTransientDelegatingHandler<FakeHandlerTwo>()
|
||||||
|
|
||||||
Both of these Add methods have a default parameter called global which is set to false. If it is false then the intent of
|
Both of these Add methods have a default parameter called global which is set to false. If it is false then the intent of
|
||||||
the DelegatingHandler is to be applied to specific ReRoutes via configuration.json (more on that later). If it is set to true
|
the DelegatingHandler is to be applied to specific ReRoutes via ocelot.json (more on that later). If it is set to true
|
||||||
then it becomes a global handler and will be applied to all ReRoutes.
|
then it becomes a global handler and will be applied to all ReRoutes.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
@ -58,7 +58,7 @@ Or transient as below...
|
|||||||
.AddTransientDelegatingHandler<FakeHandler>(true)
|
.AddTransientDelegatingHandler<FakeHandler>(true)
|
||||||
|
|
||||||
Finally if you want ReRoute specific DelegatingHandlers or to order your specific and / or global (more on this later) DelegatingHandlers
|
Finally if you want ReRoute specific DelegatingHandlers or to order your specific and / or global (more on this later) DelegatingHandlers
|
||||||
then you must add the following json to the specific ReRoute in configuration.json. The names in the array must match the class names of your
|
then you must add the following json to the specific ReRoute in ocelot.json. The names in the array must match the class names of your
|
||||||
DelegatingHandlers for Ocelot to match them together.
|
DelegatingHandlers for Ocelot to match them together.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
@ -70,8 +70,8 @@ DelegatingHandlers for Ocelot to match them together.
|
|||||||
|
|
||||||
You can have as many DelegatingHandlers as you want and they are run in the following order:
|
You can have as many DelegatingHandlers as you want and they are run in the following order:
|
||||||
|
|
||||||
1. Any globals that are left in the order they were added to services and are not in the DelegatingHandlers array from configuration.json.
|
1. Any globals that are left in the order they were added to services and are not in the DelegatingHandlers array from ocelot.json.
|
||||||
2. Any non global DelegatingHandlers plus any globals that were in the DelegatingHandlers array from configuration.json ordered as they are in the DelegatingHandlers array.
|
2. Any non global DelegatingHandlers plus any globals that were in the DelegatingHandlers array from ocelot.json ordered as they are in the DelegatingHandlers array.
|
||||||
3. Tracing DelegatingHandler if enabled (see tracing docs).
|
3. Tracing DelegatingHandler if enabled (see tracing docs).
|
||||||
4. QoS DelegatingHandler if enabled (see QoS docs).
|
4. QoS DelegatingHandler if enabled (see QoS docs).
|
||||||
5. The HttpClient sends the HttpRequestMessage.
|
5. The HttpClient sends the HttpRequestMessage.
|
||||||
|
@ -9,7 +9,7 @@ Add to Response
|
|||||||
This feature was requested in `GitHub #280 <https://github.com/TomPallister/Ocelot/issues/280>`_. I have only implemented
|
This feature was requested in `GitHub #280 <https://github.com/TomPallister/Ocelot/issues/280>`_. I have only implemented
|
||||||
for responses but could add for requests in the future.
|
for responses but could add for requests in the future.
|
||||||
|
|
||||||
If you want to add a header to your downstream response please add the following to a ReRoute in configuration.json..
|
If you want to add a header to your downstream response please add the following to a ReRoute in ocelot.json..
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ The key is "Test" and the value is "http://www.bbc.co.uk/, http://ocelot.com/".
|
|||||||
Pre Downstream Request
|
Pre Downstream Request
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Add the following to a ReRoute in configuration.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This header will be changed before the request downstream and will be sent to the downstream server.
|
Add the following to a ReRoute in ocelot.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This header will be changed before the request downstream and will be sent to the downstream server.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ Add the following to a ReRoute in configuration.json in order to replace http://
|
|||||||
Post Downstream Request
|
Post Downstream Request
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Add the following to a ReRoute in configuration.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This transformation will take place after Ocelot has received the response from the downstream service.
|
Add the following to a ReRoute in ocelot.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This transformation will take place after Ocelot has received the response from the downstream service.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ You must choose in your configuration which load balancer to use.
|
|||||||
Configuration
|
Configuration
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
The following shows how to set up multiple downstream services for a ReRoute using configuration.json and then select the LeadConnection load balancer. This is the simplest way to get load balancing set up.
|
The following shows how to set up multiple downstream services for a ReRoute using ocelot.json and then select the LeadConnection load balancer. This is the simplest way to get load balancing set up.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ Period - This value specifies the period, such as 1s, 5m, 1h,1d and so on.
|
|||||||
PeriodTimespan - This value specifies that we can retry after a certain number of seconds.
|
PeriodTimespan - This value specifies that we can retry after a certain number of seconds.
|
||||||
Limit - This value specifies the maximum number of requests that a client can make in a defined period.
|
Limit - This value specifies the maximum number of requests that a client can make in a defined period.
|
||||||
|
|
||||||
You can also set the following in the GlobalConfiguration part of configuration.json
|
You can also set the following in the GlobalConfiguration part of ocelot.json
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ architecture with Ocelot.
|
|||||||
|
|
||||||
This feature was requested as part of `Issue 79 <https://github.com/TomPallister/Ocelot/pull/79>`_ and further improvements were made as part of `Issue 298 <https://github.com/TomPallister/Ocelot/issue/298>`_.
|
This feature was requested as part of `Issue 79 <https://github.com/TomPallister/Ocelot/pull/79>`_ and further improvements were made as part of `Issue 298 <https://github.com/TomPallister/Ocelot/issue/298>`_.
|
||||||
|
|
||||||
In order to set this up you must do something like the following in your configuration.json. Here we have specified two normal ReRoutes and each one has a Key property.
|
In order to set this up you must do something like the following in your ocelot.json. Here we have specified two normal ReRoutes and each one has a Key property.
|
||||||
We then specify an Aggregate that composes the two ReRoutes using their keys in the ReRouteKeys list and says then we have the UpstreamPathTemplate which works like a normal ReRoute.
|
We then specify an Aggregate that composes the two ReRoutes using their keys in the ReRouteKeys list and says then we have the UpstreamPathTemplate which works like a normal ReRoute.
|
||||||
Obviously you cannot have duplicate UpstreamPathTemplates between ReRoutes and Aggregates. You can use all of Ocelot's normal ReRoute options apart from RequestIdKey (explained in gotchas below).
|
Obviously you cannot have duplicate UpstreamPathTemplates between ReRoutes and Aggregates. You can use all of Ocelot's normal ReRoute options apart from RequestIdKey (explained in gotchas below).
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ Advanced register your own Aggregators
|
|||||||
Ocelot started with just the basic request aggregation and since then we have added a more advanced method that let's the user take in the responses from the
|
Ocelot started with just the basic request aggregation and since then we have added a more advanced method that let's the user take in the responses from the
|
||||||
downstream services and then aggregate them into a response object.
|
downstream services and then aggregate them into a response object.
|
||||||
|
|
||||||
The configuration.json setup is pretty much the same as the basic aggregation approach apart from you need to add an Aggregator property like below.
|
The ocelot.json setup is pretty much the same as the basic aggregation approach apart from you need to add an Aggregator property like below.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ In order to use the reques tid feature you have two options.
|
|||||||
|
|
||||||
*Global*
|
*Global*
|
||||||
|
|
||||||
In your configuration.json set the following in the GlobalConfiguration section. This will be used for all requests into Ocelot.
|
In your ocelot.json set the following in the GlobalConfiguration section. This will be used for all requests into Ocelot.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ I reccomend using the GlobalConfiguration unless you really need it to be ReRout
|
|||||||
|
|
||||||
*ReRoute*
|
*ReRoute*
|
||||||
|
|
||||||
If you want to override this for a specific ReRoute add the following to configuration.json for the specific ReRoute.
|
If you want to override this for a specific ReRoute add the following to ocelot.json for the specific ReRoute.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -145,9 +145,9 @@ Priority
|
|||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
In `Issue 270 <https://github.com/TomPallister/Ocelot/pull/270>`_ I finally decided to expose the ReRoute priority in
|
In `Issue 270 <https://github.com/TomPallister/Ocelot/pull/270>`_ I finally decided to expose the ReRoute priority in
|
||||||
configuration.json. This means you can decide in what order you want your ReRoutes to match the Upstream HttpRequest.
|
ocelot.json. This means you can decide in what order you want your ReRoutes to match the Upstream HttpRequest.
|
||||||
|
|
||||||
In order to get this working add the following to a ReRoute in configuration.json, 0 is just an example value here but will explain below.
|
In order to get this working add the following to a ReRoute in ocelot.json, 0 is just an example value here but will explain below.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ In your ConfigureServices method
|
|||||||
option.Service = "Ocelot";
|
option.Service = "Ocelot";
|
||||||
});
|
});
|
||||||
|
|
||||||
Then in your configuration.json add the following to the ReRoute you want to trace..
|
Then in your ocelot.json add the following to the ReRoute you want to trace..
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ In your Configure method you need to tell your application to use WebSockets.
|
|||||||
app.UseOcelot().Wait();
|
app.UseOcelot().Wait();
|
||||||
})
|
})
|
||||||
|
|
||||||
Then in your configuration.json add the following to proxy a ReRoute using websockets.
|
Then in your ocelot.json add the following to proxy a ReRoute using websockets.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ All versions can be found `here <https://www.nuget.org/packages/Ocelot/>`_.
|
|||||||
|
|
||||||
**Configuration**
|
**Configuration**
|
||||||
|
|
||||||
The following is a very basic configuration.json. It won't do anything but should get Ocelot starting.
|
The following is a very basic ocelot.json. It won't do anything but should get Ocelot starting.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ AddOcelot() (adds ocelot services), UseOcelot().Wait() (sets up all the Ocelot m
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s => {
|
.ConfigureServices(s => {
|
||||||
@ -87,7 +87,7 @@ All versions can be found `here <https://www.nuget.org/packages/Ocelot/>`_.
|
|||||||
|
|
||||||
**Configuration**
|
**Configuration**
|
||||||
|
|
||||||
The following is a very basic configuration.json. It won't do anything but should get Ocelot starting.
|
The following is a very basic ocelot.json. It won't do anything but should get Ocelot starting.
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ An example startup using a json file for configuration can be seen below.
|
|||||||
.SetBasePath(env.ContentRootPath)
|
.SetBasePath(env.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
|
@ -7,7 +7,7 @@ Ocelot does not support...
|
|||||||
|
|
||||||
* Fowarding a host header - The host header that you send to Ocelot will not be forwarded to the downstream service. Obviously this would break everything :(
|
* Fowarding a host header - The host header that you send to Ocelot will not be forwarded to the downstream service. Obviously this would break everything :(
|
||||||
|
|
||||||
* Swagger - I have looked multiple times at building swagger.json out of the Ocelot configuration.json but it doesnt fit into the vision
|
* Swagger - I have looked multiple times at building swagger.json out of the Ocelot ocelot.json but it doesnt fit into the vision
|
||||||
I have for Ocelot. If you would like to have Swagger in Ocelot then you must roll your own swagger.json and do the following in your
|
I have for Ocelot. If you would like to have Swagger in Ocelot then you must roll your own swagger.json and do the following in your
|
||||||
Startup.cs or Program.cs. The code sample below registers a piece of middleware that loads your hand rolled swagger.json and returns
|
Startup.cs or Program.cs. The code sample below registers a piece of middleware that loads your hand rolled swagger.json and returns
|
||||||
it on /swagger/v1/swagger.json. It then registers the SwaggerUI middleware from Swashbuckle.AspNetCore
|
it on /swagger/v1/swagger.json. It then registers the SwaggerUI middleware from Swashbuckle.AspNetCore
|
||||||
@ -28,8 +28,8 @@ it on /swagger/v1/swagger.json. It then registers the SwaggerUI middleware from
|
|||||||
|
|
||||||
app.UseOcelot().Wait();
|
app.UseOcelot().Wait();
|
||||||
|
|
||||||
The main reasons why I don't think Swagger makes sense is we already hand roll our definition in configuration.json.
|
The main reasons why I don't think Swagger makes sense is we already hand roll our definition in ocelot.json.
|
||||||
If we want people developing against Ocelot to be able to see what routes are available then either share the configuration.json
|
If we want people developing against Ocelot to be able to see what routes are available then either share the ocelot.json
|
||||||
with them (This should be as easy as granting access to a repo etc) or use the Ocelot administration API so that they can query Ocelot for the configuration.
|
with them (This should be as easy as granting access to a repo etc) or use the Ocelot administration API so that they can query Ocelot for the configuration.
|
||||||
|
|
||||||
In addition to this many people will configure Ocelot to proxy all traffic like /products/{everything} to there product service
|
In addition to this many people will configure Ocelot to proxy all traffic like /products/{everything} to there product service
|
||||||
@ -40,4 +40,4 @@ package doesnt reload swagger.json if it changes during runtime. Ocelot's config
|
|||||||
information would not match. Unless I rolled my own Swagger implementation.
|
information would not match. Unless I rolled my own Swagger implementation.
|
||||||
|
|
||||||
If the user wants something to easily test against the Ocelot API then I suggest using Postman as a simple way to do this. It might
|
If the user wants something to easily test against the Ocelot API then I suggest using Postman as a simple way to do this. It might
|
||||||
even be possible to write something that maps configuration.json to the postman json spec. However I don't intend to do this.
|
even be possible to write something that maps ocelot.json to the postman json spec. However I don't intend to do this.
|
@ -3,7 +3,7 @@
|
|||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="configuration.json;appsettings.json">
|
<None Update="ocelot.json;appsettings.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -106,7 +106,7 @@ namespace OcelotGraphQL
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s => {
|
.ConfigureServices(s => {
|
||||||
|
@ -47,7 +47,7 @@ RESPONSE
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
Please note this project never goes out to another service, it just gets the data for GraphQL in memory. You would need to add the details of your GraphQL server in configuration.json e.g.
|
Please note this project never goes out to another service, it just gets the data for GraphQL in memory. You would need to add the details of your GraphQL server in ocelot.json e.g.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
2
samples/OcelotServiceFabric/.gitignore
vendored
2
samples/OcelotServiceFabric/.gitignore
vendored
@ -13,7 +13,7 @@
|
|||||||
# Service fabric
|
# Service fabric
|
||||||
OcelotApplicationApiGatewayPkg/Code
|
OcelotApplicationApiGatewayPkg/Code
|
||||||
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/appsettings.json
|
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/appsettings.json
|
||||||
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/configuration.json
|
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/ocelot.json
|
||||||
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/runtimes/
|
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/runtimes/
|
||||||
OcelotApplicationServicePkg/Code
|
OcelotApplicationServicePkg/Code
|
||||||
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/web.config
|
OcelotApplication/OcelotApplicationApiGatewayPkg/Code/web.config
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<PackageId>OcelotApplicationApiGateway</PackageId>
|
<PackageId>OcelotApplicationApiGateway</PackageId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="configuration.json;appsettings.json;">
|
<None Update="ocelot.json;appsettings.json;">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -67,7 +67,7 @@ namespace OcelotApplicationApiGateway
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Ocelot.Configuration.File;
|
using Ocelot.Configuration.File;
|
||||||
using Ocelot.Configuration.Repository;
|
using Ocelot.Configuration.Repository;
|
||||||
using Ocelot.Responses;
|
using Ocelot.Responses;
|
||||||
@ -10,7 +7,7 @@ namespace Ocelot.Configuration.Provider
|
|||||||
{
|
{
|
||||||
public class FileConfigurationProvider : IFileConfigurationProvider
|
public class FileConfigurationProvider : IFileConfigurationProvider
|
||||||
{
|
{
|
||||||
private IFileConfigurationRepository _repo;
|
private readonly IFileConfigurationRepository _repo;
|
||||||
|
|
||||||
public FileConfigurationProvider(IFileConfigurationRepository repo)
|
public FileConfigurationProvider(IFileConfigurationRepository repo)
|
||||||
{
|
{
|
||||||
|
@ -13,9 +13,11 @@ namespace Ocelot.Configuration.Repository
|
|||||||
|
|
||||||
private static readonly object _lock = new object();
|
private static readonly object _lock = new object();
|
||||||
|
|
||||||
|
private const string ConfigurationFileName = "ocelot";
|
||||||
|
|
||||||
public FileConfigurationRepository(IHostingEnvironment hostingEnvironment)
|
public FileConfigurationRepository(IHostingEnvironment hostingEnvironment)
|
||||||
{
|
{
|
||||||
_configFilePath = $"{AppContext.BaseDirectory}/configuration{(string.IsNullOrEmpty(hostingEnvironment.EnvironmentName) ? string.Empty : ".")}{hostingEnvironment.EnvironmentName}.json";
|
_configFilePath = $"{AppContext.BaseDirectory}/{ConfigurationFileName}{(string.IsNullOrEmpty(hostingEnvironment.EnvironmentName) ? string.Empty : ".")}{hostingEnvironment.EnvironmentName}.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Response<FileConfiguration>> Get()
|
public Task<Response<FileConfiguration>> Get()
|
||||||
|
@ -7,7 +7,7 @@ namespace Ocelot.DependencyInjection
|
|||||||
{
|
{
|
||||||
public static class ConfigurationBuilderExtensions
|
public static class ConfigurationBuilderExtensions
|
||||||
{
|
{
|
||||||
[Obsolete("Please set BaseUrl in configuration.json GlobalConfiguration.BaseUrl")]
|
[Obsolete("Please set BaseUrl in ocelot.json GlobalConfiguration.BaseUrl")]
|
||||||
public static IConfigurationBuilder AddOcelotBaseUrl(this IConfigurationBuilder builder, string baseUrl)
|
public static IConfigurationBuilder AddOcelotBaseUrl(this IConfigurationBuilder builder, string baseUrl)
|
||||||
{
|
{
|
||||||
var memorySource = new MemoryConfigurationSource();
|
var memorySource = new MemoryConfigurationSource();
|
||||||
|
@ -26,7 +26,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
_steps = new Steps();
|
_steps = new Steps();
|
||||||
_configurationPath = "configuration.json";
|
_configurationPath = "ocelot.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="configuration.json;appsettings.json">
|
<None Update="ocelot.json;appsettings.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -66,7 +66,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
@ -124,7 +124,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -152,7 +152,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -190,7 +190,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -221,7 +221,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -254,7 +254,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -287,7 +287,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -319,7 +319,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -358,7 +358,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -400,7 +400,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -437,7 +437,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -465,7 +465,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -525,7 +525,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
var configuration = builder.Build();
|
var configuration = builder.Build();
|
||||||
|
@ -5,6 +5,6 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
public static class TestConfiguration
|
public static class TestConfiguration
|
||||||
{
|
{
|
||||||
public static string ConfigurationPath => Path.Combine(AppContext.BaseDirectory, "configuration.json");
|
public static string ConfigurationPath => Path.Combine(AppContext.BaseDirectory, "ocelot.json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
{
|
|
||||||
"ReRoutes": [
|
|
||||||
{
|
|
||||||
"DownstreamPathTemplate": "41879/",
|
|
||||||
"UpstreamPathTemplate": "/",
|
|
||||||
"UpstreamHttpMethod": "Get",
|
|
||||||
"AuthenticationOptions": {
|
|
||||||
"Provider": null,
|
|
||||||
"ProviderRootUrl": null,
|
|
||||||
"ApiName": null,
|
|
||||||
"RequireHttps": false,
|
|
||||||
"AllowedScopes": [],
|
|
||||||
"ApiSecret": null
|
|
||||||
},
|
|
||||||
"AddHeadersToRequest": {},
|
|
||||||
"AddClaimsToRequest": {},
|
|
||||||
"RouteClaimsRequirement": {},
|
|
||||||
"AddQueriesToRequest": {},
|
|
||||||
"RequestIdKey": null,
|
|
||||||
"FileCacheOptions": {
|
|
||||||
"TtlSeconds": 0
|
|
||||||
},
|
|
||||||
"ReRouteIsCaseSensitive": false,
|
|
||||||
"ServiceName": null,
|
|
||||||
"DownstreamScheme": "http",
|
|
||||||
"DownstreamHost": "localhost",
|
|
||||||
"DownstreamPort": 41879,
|
|
||||||
"QoSOptions": {
|
|
||||||
"ExceptionsAllowedBeforeBreaking": 0,
|
|
||||||
"DurationOfBreak": 0,
|
|
||||||
"TimeoutValue": 0
|
|
||||||
},
|
|
||||||
"LoadBalancer": null,
|
|
||||||
"RateLimitOptions": {
|
|
||||||
"ClientWhitelist": [],
|
|
||||||
"EnableRateLimiting": false,
|
|
||||||
"Period": null,
|
|
||||||
"PeriodTimespan": 0,
|
|
||||||
"Limit": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"GlobalConfiguration": {
|
|
||||||
"RequestIdKey": null,
|
|
||||||
"ServiceDiscoveryProvider": {
|
|
||||||
"Provider": null,
|
|
||||||
"Host": null,
|
|
||||||
"Port": 0
|
|
||||||
},
|
|
||||||
"AdministrationPath": null,
|
|
||||||
"RateLimitOptions": {
|
|
||||||
"ClientIdHeader": "ClientId",
|
|
||||||
"QuotaExceededMessage": null,
|
|
||||||
"RateLimitCounterPrefix": "ocelot",
|
|
||||||
"DisableRateLimitHeaders": false,
|
|
||||||
"HttpStatusCode": 429
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -461,7 +461,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x =>
|
.ConfigureServices(x =>
|
||||||
@ -579,7 +579,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x => {
|
.ConfigureServices(x => {
|
||||||
@ -612,7 +612,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x =>
|
.ConfigureServices(x =>
|
||||||
@ -652,7 +652,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x => {
|
.ConfigureServices(x => {
|
||||||
@ -675,7 +675,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
|
|
||||||
private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
||||||
{
|
{
|
||||||
var configurationPath = $"{Directory.GetCurrentDirectory()}/configuration.json";
|
var configurationPath = $"{Directory.GetCurrentDirectory()}/ocelot.json";
|
||||||
|
|
||||||
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
||||||
|
|
||||||
@ -688,7 +688,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
|
|
||||||
var text = File.ReadAllText(configurationPath);
|
var text = File.ReadAllText(configurationPath);
|
||||||
|
|
||||||
configurationPath = $"{AppContext.BaseDirectory}/configuration.json";
|
configurationPath = $"{AppContext.BaseDirectory}/ocelot.json";
|
||||||
|
|
||||||
if (File.Exists(configurationPath))
|
if (File.Exists(configurationPath))
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<CodeAnalysisRuleSet>..\..\codeanalysis.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>..\..\codeanalysis.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="peers.json;configuration.json;appsettings.json;idsrv3test.pfx">
|
<None Update="peers.json;ocelot.json;appsettings.json;idsrv3test.pfx">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -301,7 +301,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
|
|
||||||
private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
||||||
{
|
{
|
||||||
var configurationPath = $"{Directory.GetCurrentDirectory()}/configuration.json";
|
var configurationPath = $"{Directory.GetCurrentDirectory()}/ocelot.json";
|
||||||
|
|
||||||
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
|
|
||||||
var text = File.ReadAllText(configurationPath);
|
var text = File.ReadAllText(configurationPath);
|
||||||
|
|
||||||
configurationPath = $"{AppContext.BaseDirectory}/configuration.json";
|
configurationPath = $"{AppContext.BaseDirectory}/ocelot.json";
|
||||||
|
|
||||||
if (File.Exists(configurationPath))
|
if (File.Exists(configurationPath))
|
||||||
{
|
{
|
||||||
@ -340,7 +340,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddJsonFile("peers.json", optional: true, reloadOnChange: true);
|
config.AddJsonFile("peers.json", optional: true, reloadOnChange: true);
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
config.AddOcelotBaseUrl(url);
|
config.AddOcelotBaseUrl(url);
|
||||||
|
@ -108,7 +108,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
config.AddJsonFile("configuration.json");
|
config.AddJsonFile("ocelot.json");
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x =>
|
.ConfigureServices(x =>
|
||||||
@ -138,7 +138,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
|
|
||||||
private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
private void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
||||||
{
|
{
|
||||||
var configurationPath = $"{Directory.GetCurrentDirectory()}/configuration.json";
|
var configurationPath = $"{Directory.GetCurrentDirectory()}/ocelot.json";
|
||||||
|
|
||||||
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ namespace Ocelot.IntegrationTests
|
|||||||
|
|
||||||
var text = File.ReadAllText(configurationPath);
|
var text = File.ReadAllText(configurationPath);
|
||||||
|
|
||||||
configurationPath = $"{AppContext.BaseDirectory}/configuration.json";
|
configurationPath = $"{AppContext.BaseDirectory}/ocelot.json";
|
||||||
|
|
||||||
if (File.Exists(configurationPath))
|
if (File.Exists(configurationPath))
|
||||||
{
|
{
|
||||||
|
0
test/Ocelot.IntegrationTests/configuration.json → test/Ocelot.IntegrationTests/ocelot.json
Executable file → Normal file
0
test/Ocelot.IntegrationTests/configuration.json → test/Ocelot.IntegrationTests/ocelot.json
Executable file → Normal file
@ -16,7 +16,7 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="configuration.json;appsettings.json;idsrv3test.pfx">
|
<None Update="ocelot.json;appsettings.json;idsrv3test.pfx">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -21,7 +21,7 @@ namespace Ocelot.ManualTest
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("configuration.json")
|
.AddJsonFile("ocelot.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s => {
|
.ConfigureServices(s => {
|
||||||
|
@ -113,7 +113,7 @@ namespace Ocelot.UnitTests.Configuration
|
|||||||
|
|
||||||
private void GivenTheConfigurationIs(FileConfiguration fileConfiguration)
|
private void GivenTheConfigurationIs(FileConfiguration fileConfiguration)
|
||||||
{
|
{
|
||||||
var configurationPath = $"{AppContext.BaseDirectory}/configuration{(string.IsNullOrEmpty(_environmentName) ? string.Empty : ".")}{_environmentName}.json";
|
var configurationPath = $"{AppContext.BaseDirectory}/ocelot{(string.IsNullOrEmpty(_environmentName) ? string.Empty : ".")}{_environmentName}.json";
|
||||||
|
|
||||||
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
var jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
||||||
|
|
||||||
|
0
test/Ocelot.UnitTests/configuration.json → test/Ocelot.UnitTests/ocelot.json
Executable file → Normal file
0
test/Ocelot.UnitTests/configuration.json → test/Ocelot.UnitTests/ocelot.json
Executable file → Normal file
Loading…
x
Reference in New Issue
Block a user