Skip to content

Commit

Permalink
feat: parametrize base url
Browse files Browse the repository at this point in the history
  • Loading branch information
martinalbert committed Oct 28, 2024
1 parent 6120c08 commit d015720
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ButterCMS/ButterCMSClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ButterCMSClient
private TimeSpan defaultTimeout = new TimeSpan(0, 0, 10);
private int maxRequestTries;

private const string apiBaseAddress = "https://api.buttercms.com/";
private const string apiBaseAddressDefault = "https://api.buttercms.com/";

private const string listPostsEndpoint = "v2/posts/";
private const string retrievePostEndpoint = "v2/posts/{0}/";
Expand Down Expand Up @@ -56,6 +56,7 @@ public ButterCMSClient(string authToken, TimeSpan? timeOut = null, int maxReques
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif

string apiBaseAddress = Environment.GetEnvironmentVariable("API_BASE_URL") ?? apiBaseAddressDefault;
httpClient = new HttpClient(httpMessageHandler ?? new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
Expand Down

0 comments on commit d015720

Please sign in to comment.