-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfefcaf
commit 6e2aea6
Showing
12 changed files
with
1,425 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This file is a template, and might need editing before it works on your project. | ||
# Publishes a tag/branch to Composer Packages of the current project | ||
publish: | ||
image: curlimages/curl:latest | ||
stage: build | ||
variables: | ||
URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN" | ||
script: | ||
- version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG") | ||
- insecure=$([ "$CI_SERVER_PROTOCOL" = "http" ] && echo "--insecure" || echo "") | ||
- response=$(curl -s -w "\n%{http_code}" $insecure --data $version $URL) | ||
- code=$(echo "$response" | tail -n 1) | ||
- body=$(echo "$response" | head -n 1) | ||
# Output state information | ||
- if [ $code -eq 201 ]; then | ||
echo "Package created - Code $code - $body"; | ||
else | ||
echo "Could not create package - Code $code - $body"; | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* SFX Store Config interface | ||
* | ||
* Copyright © MageXo, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace StorefrontX\SfxStoreConfig\Api; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
|
||
interface SfxStoreConfigInterface | ||
{ | ||
/** | ||
* Retrieve SFX URL value by scope. | ||
* | ||
* @param null|int|string $scopeCode | ||
* @return string | ||
*/ | ||
public function getSfxUrl($scopeCode = null):string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Copyright © MageXo, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace StorefrontX\SfxStoreConfig\Model; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use StorefrontX\SfxStoreConfig\Api\SfxStoreConfigInterface; | ||
|
||
/** | ||
* SFX fields in store config | ||
*/ | ||
class SfxStoreConfigFields implements SfxStoreConfigInterface | ||
{ | ||
private const SFX_URL = 'web/sfx/sfx_base_url'; | ||
|
||
private ScopeConfigInterface $scopeConfig; | ||
|
||
public function __construct(ScopeConfigInterface $scopeConfig) | ||
{ | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* Get media URL format for catalog images | ||
* | ||
* @param null|int|string $scopeCode | ||
* @return string | ||
*/ | ||
public function getSfxUrl($scopeCode = null): string | ||
{ | ||
$value = $this->scopeConfig->getValue( | ||
self::SFX_URL, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
$scopeCode | ||
); | ||
|
||
return (string)$value; | ||
} | ||
} |
Oops, something went wrong.