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

feat: nodeshift login with cli #545

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

lholmquist
Copy link
Member

@lholmquist lholmquist commented Feb 19, 2021

This PR adds the login command. It is meant to be run first with either a username/password or a valid token and the api server of the cluster

something like this: nodeshift login --token=12345 --server=https....... then run nodeshift deploy. While you can specify all those argument flags with the deploy command, this cleans things up a bit

The new login command will write the authtoken and the api server to a login.json file that lives in PROJECT_LOCATION/tmp/nodeshift/config/login.json. this tmp directory is also used in the build and deploy steps, and should be gitignored.

CLI Usage - Login:

$ nodeshift login --username=developer --password=password --server=https://api.server

or 

$ nodeshift login --token=12345 --server=https://api.server

CLI Usage - Logout

$ nodeshift logout

API usage using async/await would look something like this:

const nodeshift = require('nodeshift');

const options = {
  username: 'kubeadmin',
  password: '...',
  server: '...',
  insecure: true
};

(async () => {
  await nodeshift.login(options);
  await nodeshift.deploy();
  await nodeshift.logout();
})();

@lholmquist lholmquist changed the title nodeshift login with cli feat: nodeshift login with cli Feb 19, 2021
@coveralls
Copy link

coveralls commented Feb 19, 2021

Coverage Status

Coverage decreased (-98.3%) to 0.0% when pulling 999eaca on lholmquist:NODE-899-nodeshift-login into 509f0a5 on nodeshift:master.

@lholmquist lholmquist marked this pull request as ready for review February 20, 2021 15:33
* This adds 2 new commands:  login and logout

This PR adds the `login` command.  It is meant to be run first with either a username/password or a valid token and the api server of the cluster

something like this: `nodeshift login --token=12345 --server=https.......`  then run `nodeshift deploy`.  While you can specify all those argument flags with the deploy command,  this cleans things up a bit

The new login command will write the authtoken and the api server to a login.json file that lives in `PROJECT_LOCATION/tmp/nodeshift/config/login.json`.  this tmp directory is also used in the build and deploy steps,  and should be gitignored.

CLI Usage - Login:

```
$ nodeshift login --username=developer --password=password --server=https://api.server

or

$ nodeshift login --token=12345 --server=https://api.server
```

CLI Usage - Logout

```
$ nodeshift logout
```

API usage using async/await would look something like this:

```
const nodeshift = require('nodeshift');

const options = {
  username: 'kubeadmin',
  password: '...',
  server: '...',
  insecure: true
};

(async () => {
  await nodeshift.login(options);
  await nodeshift.deploy();
  await nodeshift.logout();
})();
```
@lholmquist lholmquist merged commit f197389 into nodeshift:master Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants