Hi All, I couldn't find answer to this in the chan...
# sdf
t
Hi All, I couldn't find answer to this in the channel so apologies if its been asked before when running
Copy code
suitecloud account:setup
rather than using the arrow keys to select the saved authentication id is it possible to pass the saved aithentication id via the commandline call
Copy code
suitecloud account:setup -authid=account-SB1-Dev
looking to running it through an automated process to run into a selenium grid Thanks in advanced
s
I don't think it is available with account:setup. However, if you find a secure way to store/pass your credentials to account:savetoken, it might do the trick.
m
I did a Git Workflow exactly to automate and instead use account setup i use account:savetoken
suitecloud account:savetoken --account $ACCOUNT_ID --authid AUTH_NAME --tokenid $TOKEN_ID --tokensecret $TOKEN_SECRET
suitecloud account:manageauth --list
👍 1
m
The other option is just to create/update the
project.json
file with the authid. I do this in my CI/CD setup. There are a number of SDF projects that may need to be deployed, so I save the token once and create a
project.json
for each project.
👍 1
Copy code
/**
   * Save the token for SDF. To improve performance, instead of running this for each project we are
   * validating, we will use the legacy project here and manually generate a project.json for each
   * project.
   */
  async function saveSDFToken() {
    const { NS_ACCOUNT_ID, NS_TOKEN_ID, NS_TOKEN_SECRET } = process.env;

    const cwd = `./src/${LEGACY_PROJECT_NAME}`;

    await exec.exec(
      `npx suitecloud account:savetoken --account ${NS_ACCOUNT_ID} --authid ${NS_ACCOUNT_ID} --tokenid ${NS_TOKEN_ID} --tokensecret ${NS_TOKEN_SECRET}`,
      [],
      { cwd }
    );
  }

  /**
   * Generate a project.json for the project
   *
   * @param {string} projectName
   * @returns {Promise<void>} Promise that resolves when project.json has been generated
   */
  async function generateProjectJson(projectName) {
    const { NS_ACCOUNT_ID } = process.env;

    const cwd = `./src/${projectName}`;

    const content = { defaultAuthId: NS_ACCOUNT_ID };

    return fs.promises.writeFile(`${cwd}/project.json`, JSON.stringify(content));
  }
👍 2
👍🏻 1
t
I was playing with the project.json this morning and got it working that way
m
Nice!