Setting up local - can you run hs init for sandbox and live plus examples of navigating to folders

New Contributor

Hello

 

I am in the process of setting up local development

 

I have successfully installed command line interface

 

I am at the  point of running a hs init command for the first time - can u run the hs init repeatly as I have a sandbox account and live account. Does the associated yaml file  therefore hold two entries within it

 

Plus  in terms of hs line command say with hs fetch  where u assign  a src and destination folderdo have actual examples of what sort paths you need create for example do you need to use

 

For example

When sandbox is the name I  create in the hs init process not the name of the hs account

based on the following syntax

hs fetch --portal=<name> <src> <dest>

 

Us what is shown below is  the correct syntax if i want to copy a specific folder from my sandbox design manager (where custom lays at the root of the design manager structure)

 

hs fetch --portal=sandbox   custom/foldername1/foldername2    C:\Users\myname\Documents\hubspot_local\custom\foldername1\foldername2 

 

Alternatively in respect to local file how do set up current working directory do u have to navigate to the folder in command prompt then run the hs command or in the example given does this depend on this being set up by the tool your using - in the example given your using Visual Studio IDE and your opening the local folder from within it.

 

Many thanks

Reply
0 Upvotes
8 Replies 8
Regular Contributor | Partner

Hi there,

 

for the fetch command, src will be the folder in which you wish to pull down from your design manager this could be just my-theme  (whatever the folder is in your design manager) and then the destination could the folder on your local, which could also match.

 

for example yours could be 

hs fetch --portal=<name> custom theme-2020

custom being the folder and all it's contents as shown in design manager's root

theme-2020 being the new folder relative to the directory you're using this command (on your local)

Thats assuming you're using the command in your project root and your project root has a folder called theme-2020

 

 

New Contributor

Thanks Sandy

 I give it a bash

 

 

Reply
0 Upvotes
Regular Contributor | Elite Partner

Hey @simonp

Regarding your first question, best practice is to run

 

hs init

 

Once and any subsequent portals be added using

 

hs auth

 

That way only one YAML file is being generated. The CLI will then prompt you to name each portal (something like 'sandbox' and 'production' works) and then use the appropriate name for your development and deployment actions.

 

@SandyG1's answer should help out with the second question around fetch but I will also advise that you look at the docs for the --overwrite flag if you have any local files in the dest folder you specify as part of your fetch command. By default, any files with the same name will not be overwritten.

New Contributor

Thanks for everybody help

 

I succesfully connected and downloaded files, hs init part seened to be more clearly defined

 

I am at the hs auth, typing  hs auth gives me following message  :-

 

configure authentication for hubspot account. Supported authentication protocal are oauth2 and personnelkey

Then a series of options.

 

Not sure what to do after this - so do i manual ammend the .yaml file eg the hubspt example - Add the 2nd account with the different nickname/ the portalID/ the same accessToken and personalAccessKey?

 

defaultPortal: Livesite
portals:
  - name: sandbox
    portalId: 5678930
    authType: personalaccesskey
    personalAccessKey: >-
      xxxxx-xxxxxx-xxxxxxx-xxxxxx-xxxxx-xxxxxxx-xxxxxxxx
    auth:
      tokenInfo:
        accessToken: >-
          xxxxx-xxxxxx-xxxxxxx-xxxxxx-xxxxx-xxxxxxx-xxxxxxxx
        expiresAt: '2020-01-01T00:00:00.000Z'
  - name: Livesite
    portalId: 8945555
    authType: personalaccesskey
    personalAccessKey: >-
      xxxxx-xxxxxx-xxxxxxx-xxxxxx-xxxxx-xxxxxxx-xxxxxxxx
    auth:
      tokenInfo:
        accessToken: >-
          xxxxx-xxxxxx-xxxxxxx-xxxxxx-xxxxx-xxxxxxx-xxxxxxxx
        expiresAt: '2020-01-01T00:00:00.000Z'

 

 

Reply
0 Upvotes
New Contributor

? do run 

 

hs auth xxxxx-xxxxxx-xxxxxxx-xxxxxx-xxxxx-xxxxxxx-xxxxxxxx

where xx = personal key generated from the original hs init

Reply
0 Upvotes
New Contributor

nope thats not it?

Reply
0 Upvotes
New Contributor

ok got it now -  you  actually use

hs auth personalaccesskey

where the command will take the value from the yaml value

 

You then follow the same steps as hs init where you asked to open a browser window.

 

Here goes!

 

Jeesz! 

Reply
0 Upvotes
New Contributor

Created the.yaml file

 

Slight problem  - Nothing hubspot related Command prompt not playing ball with using controlV so check properties of the command prompt window and change to CTRL SHIFT V and able drop the copied password into value required

 

 

Thanks for everyones help

 

 

 

Reply
0 Upvotes