Add additional Storefront URL with CLI - shopware

I install Shopware 6 on CLI. My shop is reachable over HTTP and HTTPS.
The cli-installer will create a storefront with my given URL like https://demo.shop.
My problem now is that I need the shop to be reachable without TLS too. How can I add another Storefront URL?
I tried to use the command bin/console sales-channel:create:storefront --id=e28bf43c262f4343938a7b8a841ed136 --url=http://demo.shop but this will fail with
6:06:05 CRITICAL [console] Error thrown while running command "sales-channel:create:storefront --id=e28bf43c262f4343938a7b8a841ed136 --url='http://demo.shop'". Message: "Expected command for "sales_channel" to be "Shopware\Core\Framework\DataAbstractionLayer\Write\Command\InsertCommand". (Got: Shopware\Core\Framework\DataAbstractionLayer\Write\Command\UpdateCommand)" ["exception" => Shopware\Core\Framework\DataAbstractionLayer\Write\Command\WriteTypeIntendException^ { …},"command" => "sales-channel:create:storefront --id=e28bf43c262f4343938a7b8a841ed136 --url='http://demo.shop'","message" => "Expected command for "sales_channel" to be "Shopware\Core\Framework\DataAbstractionLayer\Write\Command\InsertCommand". (Got: Shopware\Core\Framework\DataAbstractionLayer\Write\Command\UpdateCommand)"]
How can I solve this?

As the name of the command suggests it is only meant to create new sales channels, not for updating an existing one.
Why not create the additional domain using the administration web-interface?
If you can't access the web-interface for some reason you could change the domain with the command bin/console sales-channel:update:domain instead. This will change the domain for all sales channels unless you provide a specific one to replace. See the help option of the command regarding that.
To actually create additional sales channel domains you may also use the API endpoint, see here or here.

Related

Shopware 6 Unable to find a matching sales channel for the request

I have been stuck on this for long enough now, basically I am wanting to try and use Shopware 6 as a PWA.
To install shopware I make use of Valet and Git.
But I am never able to use install Shopware6 in the right way because I am always getting the same error:
This is how I am installing Shopware6:
clone git repo -->https://github.com/shopware/production;
cd /production;
-composer install (to install dependencies)
./bin/console system:setup - At this step I am asked to input some datas:
Application environment [dev]: //dev;
URL to your /public folder [http://localhost]: // http://production.test;
Blue Green Deployment (yes/no) [yes]: //yes
Database user [app]: //root
Database password: //root
Database host [localhost]: //
Database port [3306]: //
Database name [shopware]: //
Database SSL CA Path []: //
Database SSL Cert Path []: //
Database SSL Key Path []: //
Skip verification of the database server's SSL certificate? (yes/no) [no]: //no
Once Shopware 6 is installed I would visit production/public to create a valet link (virtual host).
valet link production.test
I visit my virtual host on http://production.test
At this moment I always get the above mentioned error: Unable to find a matching sales channel for the request: http://production.test/". Please make sure the domain mapping is correct.
This is a bit odd. Good news is that your installation seems to be working, but for some reason it sounds like your SalesChannel -> domain is not set. Try logging into http://production.test/admin & going to the Storefront sales channel. There you can configure the domain.
You can see it here as an example:

Azure Functions NodeJs: Remove Http Response Header

I have an HTTP triggered, NodeJs Azure Function, and I'm looking to remove the "X-Powered-By" header from my response, but have found no way to do so.
I've tried adding both this and this azure site extensions, but neither has worked for me,
Setting the response header manually, i.e. res.headers = { ['x-powered-by']: null } is ineffective.
Based on the comments made on this github issue: https://github.com/Azure/Azure-Functions/issues/290 it would seem that using either extension should have removed the headers you wanted.
Modifying the response headers will likely won't work as they are probably added further down the pipeline by the function host and not overridable, see:
Access Azure Function runtime settings
Azure functions recently removed the x-aspnet-version header, further removal of other headers is tracked as part of the azure-webjobs-script-sdk here
You should leave a comment on the github issue and you can further discuss with the team working on this.
There is an extension called Remove Custom Headers that works for Web Apps but not for functions that have their own resource group. So, what you can do is:
1. Create a regular Web App
2. Create a function and make sure you use the same Hosting Plan as the Web App (do not use Consumption).
3. Once the function is created, install the extension named: "Remove Custom Headers"
4. Restart the function and the headers (Server and X-Powered-By) should disappear.

Drupal8 module development: hook_node_access not called

for my current site I have a content type that stores a user in an entity reference field. I want to allow the user referenced in this field to edit the data of that node. In drupal7 I would do that with a node_access hook - which I am not getting to work in drupal8.
Here is a demo code of my hook - for testing purposes I want to forbid everything. However it is never called, and no - I am not logged in as user1. Also reseted cache, uninstalled and installed the module again and rebuilt the permissions - nothing seems to make this hook work.
function mymodule_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account) {
$access = new AccessResultForbidden();
return $access;
}
My question is why is this hook never called - and if there is now with drupal 8 a better way to do so?
Any help will be appreciated.
Best regards,
Rambazamba
This hook is never called for user 1, since he bypasses every access control.
Try testing anonymously or as another role.
Try the following command. The tool 'drupal console' is required.
drupal node:access:rebuild

Add GitLab Web hook for all projects in group

I would like all my projects in a GitLab group to have shared configuration for a webhook:
<MY_JENKINS_INSTANCE>/git/notifyCommit?url=$CHANGED_REPOSITORY
GitLab webhook documentation suggests it should be possible:
If you have a big set of projects in the one group then it will be convenient for you to configure web hooks globally for the whole group. You can add the group level web hooks on the group settings page.
That sound exactly like what I am after though I see no such thing on group settings page in my gitlab 7.0.0. I was not able to find out if this feature is not newer than that in the changelog.
Does the feature exist? How do I use it?
That's possible in the enterprise version only:
In GitLab Enterprise Edition you can configure web hooks globally for the whole group. You can add the group level web hooks on the group settings page Settings > Web Hooks.
Following up on #VertigoRay's comments, here's a procedure to do it using GitLab CE API:
Have, or create an user in GitLab and a personal access token with api scope:
User (top right avatar) > Settings (menu) > Access tokens (sidebar)
Check api scope (checkbox)
Click on create personal access token (button)
<my_personal_token> is the value in Your New Personal Access Token (text field)
Perform an HTTP request to get all projects:
GET https://gitlab.example.com/api/v4/projects
Private-Token: <my_personal_token>
Accept: application/json
For each project in the response:
id which is the <project_ID> to be used in the next request URL
Convert the value of ssh_url_to_repo so that it becomes URL encoded <encoded_ssh_url>
Example: ssh://git#example.com:1234/group/alpha.git becomes ssh%3A%2F%2Fgit%40example.com%3A1234%2Fgroup%2Falpha.git
For each project, perform an HTTP request to create a hook:
POST https://gitlab.example.com/api/v4/projects/<project_ID>/hooks
Private-Token: <my_personal_token>
Content-Type: application/json
{
"url": "https://jenkins.example.com/git/notifyCommit?url=<encoded_ssh_url>",
"enable_ssl_verification": true
}
This should be scripted in the langage of your choice.
Not suitable as a persistent solution, but this might be useful for someone looking for a one-time change (from the raketasks documentation):
Add a webhook for projects in a given NAMESPACE
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme
# source installations
bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme RAILS_ENV=production

jenkins: setting root url via Groovy API

I'm trying to update Jenkins' root URL via the Groovy API, so I can script the deployment of a Jenkins master without manual input (aside: why is a tool as popular with the build/devops/automation community as Jenkins so resistant to automation?)
Based on this documentation, I believe I should be able to update the URL using the following script in the Script Console.
import jenkins.model.JenkinsLocationConfiguration
jlc = new jenkins.model.JenkinsLocationConfiguration()
jlc.setUrl("http://jenkins.my-org.com:8080/")
println(jlc.getUrl())
Briefly, this instantiates a JenkinsLocationConfiguration object; calls the setter setUrl with the desired value, http://jenkins.my-org.com:8080/; and prints out the new URL to confirm that it has changed.
The println statement prints what I expect it to, but following this, the value visible through the web interface at "Manage Jenkins" -> "Configure System" -> "Jenkins URL" has not updated as I expected.
I'm concerned that the value hasn't been update properly by Jenkins, which might lead to problems when communicating with external APIs.
Is this a valid way to fix the Jenkins root URL? If not, what is? Otherwise, why isn't the change being reflected in the config page?
You are creating a new JenkinsLocationConfiguration object, and updating the new one, not the existing one being used
use
jlc = JenkinsLocationConfiguration.get()
// ...
jlc.save()
to get the one from the global jenkins configuration, update it and save the config descriptor back.
see : https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java

Resources