Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always add magento2 api configuration #2036

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions core/scripts/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,12 @@ class Backend extends Abstract {
config.imageable.whitelist.allowedHosts.push(host)

config.magento2.url = urlParser(this.answers.m2_url).href
config.magento2.api.url = urlParser(this.answers.m2_api_url).href
config.magento2.api.consumerKey = this.answers.m2_api_consumer_key
config.magento2.api.consumerSecret = this.answers.m2_api_consumer_secret
config.magento2.api.accessToken = this.answers.m2_api_access_token
config.magento2.api.accessTokenSecret = this.answers.m2_api_access_token_secret
config.magento2.imgUrl = urlParser(this.answers.images_endpoint).href
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt be default fallback applied here as well? @Cyclonecode

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkarw
Nope, not really since the this.answers.images_endpoint is always set in this stage.
If you are not using the default (https://demo.vuestorefront.io) as a backend you will be prompted to choose the images endpoint even if you later decide not to setup credentials or am I missing something:

Choose path for images endpoint (Use arrow keys)
https://demo.vuestorefront.io/img/
http://localhost:8080/img/
Custom url

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Thanks

config.magento2.api.url = urlParser(this.answers.m2_api_url).href || config.magento2.api.url
config.magento2.api.consumerKey = this.answers.m2_api_consumer_key || config.magento2.api.consumerKey
config.magento2.api.consumerSecret = this.answers.m2_api_consumer_secret || config.magento2.api.consumerSecret
config.magento2.api.accessToken = this.answers.m2_api_access_token || config.magento2.api.accessToken
config.magento2.api.accessTokenSecret = this.answers.m2_api_access_token_secret || config.magento2.api.accessTokenSecret

jsonFile.writeFileSync(TARGET_BACKEND_CONFIG_FILE, config, {spaces: 2})
} catch (e) {
Expand Down Expand Up @@ -732,21 +733,21 @@ let questions = [
}
},
{
type: 'confirm',
name: 'm2_api_oauth2',
message: `Would You like to perform initial data import from Magento2 instance?`,
default: false,
type: 'input',
name: 'm2_url',
message: 'Please provide your magento url',
default: 'http://demo-magento2.vuestorefront.io',
when: function (answers) {
return answers.is_remote_backend === false
}
},
{
type: 'input',
name: 'm2_url',
message: 'Please provide your magento url',
default: 'http://demo-magento2.vuestorefront.io',
type: 'confirm',
name: 'm2_api_oauth2',
message: `Would You like to perform initial data import from Magento2 instance?`,
default: false,
when: function (answers) {
return answers.m2_api_oauth2 === true
return answers.is_remote_backend === false
}
},
{
Expand Down