Skip to content

Commit eab5a57

Browse files
Merge pull request #393 from commercetools/example-regions
add region addresses to example
2 parents 03893bd + b559399 commit eab5a57

8 files changed

Lines changed: 24 additions & 9 deletions

File tree

examples/symfony-app-datadog/docker/php/.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ APP_ENV=dev
1919
APP_CTP_CLIENT_ID=your client id
2020
APP_CTP_CLIENT_SECRET=your client secret
2121
APP_CTP_PROJECT_KEY=your project key
22+
APP_CTP_API_URI=https://api.europe-west1.gcp.commercetools.com
23+
APP_CTP_AUTH_URI=https://auth.europe-west1.gcp.commercetools.com/oauth/token
2224
DD_AGENT_HOST=datadog-agent
2325
DD_TRACE_AGENT_PORT=8126
2426
DD_SERVICE=symfony-app

examples/symfony-app-datadog/src/Client/RequestBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ public function __construct()
1919
$clientId = $_ENV['APP_CTP_CLIENT_ID'];
2020
$clientSecret = $_ENV['APP_CTP_CLIENT_SECRET'];
2121
$this->projectKey = $_ENV['APP_CTP_PROJECT_KEY'];
22+
$apiUri = $_ENV['APP_CTP_API_URI'] ?? Config::API_URI;
23+
$authUri = $_ENV['APP_CTP_AUTH_URI'] ?? ClientCredentialsConfig::AUTH_URI;
2224

23-
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret));
24-
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3]), $authConfig);
25+
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret), [], $authUri);
26+
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3], $apiUri), $authConfig);
2527

2628
}
2729

examples/symfony-app-dynatrace/docker/php/.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ APP_ENV=dev
1919
APP_CTP_CLIENT_ID=your client id
2020
APP_CTP_CLIENT_SECRET=your client secret
2121
APP_CTP_PROJECT_KEY=your project key
22+
APP_CTP_API_URI=https://api.europe-west1.gcp.commercetools.com
23+
APP_CTP_AUTH_URI=https://auth.europe-west1.gcp.commercetools.com/oauth/token
2224
DYNATRACE_URL=https://<your environment ID>.live.dynatrace.com/api
2325
DT_API_TOKEN=<your dynatrace api token>
2426

examples/symfony-app-dynatrace/src/Client/RequestBuilder.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ public function __construct()
1919
$clientId = $_ENV['APP_CTP_CLIENT_ID'];
2020
$clientSecret = $_ENV['APP_CTP_CLIENT_SECRET'];
2121
$this->projectKey = $_ENV['APP_CTP_PROJECT_KEY'];
22+
$apiUri = $_ENV['APP_CTP_API_URI'] ?? Config::API_URI;
23+
$authUri = $_ENV['APP_CTP_AUTH_URI'] ?? ClientCredentialsConfig::AUTH_URI;
2224

23-
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret));
24-
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3]), $authConfig);
25-
25+
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret), [], $authUri);
26+
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3], $apiUri), $authConfig);
2627
}
2728

2829
public function getApiRequestBuilder()

examples/symfony-app-newrelic/docker/php/.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ APP_ENV=dev
1919
APP_CTP_CLIENT_ID=your client id
2020
APP_CTP_CLIENT_SECRET=your client secret
2121
APP_CTP_PROJECT_KEY=your project key
22+
APP_CTP_API_URI=https://api.europe-west1.gcp.commercetools.com
23+
APP_CTP_AUTH_URI=https://auth.europe-west1.gcp.commercetools.com/oauth/token
2224
NEW_RELIC_LICENSE_KEY=your new relic license key
2325
NEW_RELIC_APP_NAME=PHP-SDK
2426

examples/symfony-app-newrelic/src/Client/RequestBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ public function __construct()
1919
$clientId = $_ENV['APP_CTP_CLIENT_ID'];
2020
$clientSecret = $_ENV['APP_CTP_CLIENT_SECRET'];
2121
$this->projectKey = $_ENV['APP_CTP_PROJECT_KEY'];
22+
$apiUri = $_ENV['APP_CTP_API_URI'] ?? Config::API_URI;
23+
$authUri = $_ENV['APP_CTP_AUTH_URI'] ?? ClientCredentialsConfig::AUTH_URI;
2224

23-
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret));
24-
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3]), $authConfig);
25+
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret), [], $authUri);
26+
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3], $apiUri), $authConfig);
2527

2628
}
2729

examples/symfony-app-opentelemetry/docker/php/.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ APP_ENV=dev
1919
APP_CTP_CLIENT_ID=your client id
2020
APP_CTP_CLIENT_SECRET=your client secret
2121
APP_CTP_PROJECT_KEY=your project key
22+
APP_CTP_API_URI=https://api.europe-west1.gcp.commercetools.com
23+
APP_CTP_AUTH_URI=https://auth.europe-west1.gcp.commercetools.com/oauth/token
2224
NEW_RELIC_LICENSE_KEY=your new relic lincense key
2325

2426
# APP_NAME=PHP-SDK

examples/symfony-app-opentelemetry/src/Client/RequestBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ public function __construct()
1919
$clientId = $_ENV['APP_CTP_CLIENT_ID'];
2020
$clientSecret = $_ENV['APP_CTP_CLIENT_SECRET'];
2121
$this->projectKey = $_ENV['APP_CTP_PROJECT_KEY'];
22+
$apiUri = $_ENV['APP_CTP_API_URI'] ?? Config::API_URI;
23+
$authUri = $_ENV['APP_CTP_AUTH_URI'] ?? ClientCredentialsConfig::AUTH_URI;
2224

23-
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret));
24-
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3]), $authConfig);
25+
$authConfig = new ClientCredentialsConfig(new ClientCredentials($clientId, $clientSecret), [], $authUri);
26+
$this->client = ClientFactory::of()->createGuzzleClient(new Config(['maxRetries' => 3], $apiUri), $authConfig);
2527
}
2628

2729
public function getApiRequestBuilder()

0 commit comments

Comments
 (0)