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

Revert config migration #397

Merged
merged 4 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions packages/cms-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ _**Note:** The Account ID used should be the CMS Account ID (not the developer a
2. Edit the `hubspot.config.yml` file to set the `authType` for the account to `apikey` and add `apiKey` as shown below:

```yaml
defaultAccount: DEV
accounts:
defaultPortal: DEV
portals:
- name: DEV
accountId: 123
portalId: 123
authType: apikey
apiKey: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
```
2 changes: 1 addition & 1 deletion packages/cms-cli/commands/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ exports.handler = async options => {
functionId: functionResp.id,
functionPath,
accountId,
accountName: options.portal || options.account,
accountName: options.portal,
compact,
});
} else if (latest) {
Expand Down
8 changes: 4 additions & 4 deletions packages/cms-cli/hubspot.sample.config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defaultAccount: DEV
defaultPortal: DEV

# Optionally set the default mode for all accounts
defaultMode: publish
Expand All @@ -10,17 +10,17 @@ httpTimeout: 30000
allowUsageTracking: false

# List of accounts that are intended to be used
accounts:
portals:
# Account set up to use an API Key
- name: DEV
accountId: 123
portalId: 123
# Override mode for account
defaultMode: draft
authType: apikey
apiKey: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
# Account set up to use OAuth2
- name: PROD
accountId: 456
portalId: 456
authType: oauth2
auth:
clientId: d996372f-2b53-30d3-9c3b-4fdde4bce3a2
Expand Down
10 changes: 3 additions & 7 deletions packages/cms-cli/lib/commonOpts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const {
const { LOG_LEVEL } = Logger;

const addAccountOptions = program =>
program.option('account', {
alias: ['a', 'portal', 'p'],
describe: 'HubSpot account id or name from config',
program.option('portal', {
alias: ['p', 'account', 'a'],
describe: 'HubSpot portal id or name from config',
type: 'string',
});

Expand Down Expand Up @@ -85,10 +85,6 @@ const getAccountId = (options = {}) => {
return parseInt(process.env.HUBSPOT_PORTAL_ID, 10);
}

if (options.useEnv && process.env.HUBSPOT_ACCOUNT_ID) {
drewjenkins marked this conversation as resolved.
Show resolved Hide resolved
return parseInt(process.env.HUBSPOT_ACCOUNT_ID, 10);
}

return getAccountIdFromConfig(portal || account);
};

Expand Down
4 changes: 2 additions & 2 deletions packages/cms-cli/lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const redirectUri = `http://localhost:${PORT}/oauth-callback`;
const buildAuthUrl = oauthManager => {
return (
`${getHubSpotWebsiteOrigin(oauthManager.env)}/oauth/${
oauthManager.accountId
oauthManager.portalId
}/authorize` +
`?client_id=${encodeURIComponent(oauthManager.clientId)}` + // app's client ID
`&scope=${encodeURIComponent(oauthManager.scopes.join(' '))}` + // scopes being requested by the app
Expand Down Expand Up @@ -91,7 +91,7 @@ const setupOauth = (accountId, accountConfig) => {
};

const authenticateWithOauth = async configData => {
const accountId = parseInt(configData.accountId, 10);
const accountId = parseInt(configData.portalId, 10);
const oauthManager = setupOauth(accountId, configData);
logger.log('Authorizing');
await authorize(oauthManager);
Expand Down
Loading