Commit Graph

101 Commits

Author SHA1 Message Date
Juan Carlos Mejías Rodríguez
64619fc90f Remove error return from Client.Clone() 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
0d42ed73c6 Enhance Portainer URL parsing in Client 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
00439cc1c1 Delay new auth token retrieval until it is really necessary 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
04a05fad86 Move clientConfig declaration to the top 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
8d0fb72034 Fix PortainerClient.Authenticate usage of viper 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
064e7789fb Add comments to Client 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
5dc5f43763 Remove unused CheckResponseForErrors error handling helper
It's logic is now implemented into the Client
2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
93f08172ac Rename Client.DoJson to doJson 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
70621c750c Move URL handling logic (calls to DoJson) into Client 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
7f048def9c Remove old unused connection and authentication code 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
fa666db1b8 Replace manual request creation and marshaling with new client 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
1b1c2bc1d1 Encapsulate network communication into a Client struct 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
a22aaa20f5 Format code 2019-08-08 11:56:07 -04:00
Juan Carlos Mejías Rodríguez
d770da7414 Enhance error printing 2019-07-23 22:44:29 -04:00
Juan Carlos Mejías Rodríguez
6200b6c667 Add login command to log in to a Portainer instance 2019-07-23 22:12:45 -04:00
Juan Carlos Mejías Rodríguez
53d26a8ac3 Split config setting and getting into separate functions 2019-07-23 21:59:08 -04:00
Juan Carlos Mejías Rodríguez
143215b39f Add --auth-token global flag to set the auth flag to be used with potainer 2019-07-23 21:57:26 -04:00
Juan Carlos Mejías Rodríguez
35a0d089cb Add shorthands for --url, --user, --password and --insecure flags 2019-07-23 21:27:38 -04:00
Juan Carlos Mejías Rodríguez
44319f3655 Change --prune flag shorthand to -r 2019-07-23 21:27:38 -04:00
Juan Carlos Mejías Rodríguez
3d475143c1 Add --keys flag to config list command to show only config keys 2019-07-23 21:27:34 -04:00
Juan Carlos Mejías Rodríguez
1ca444a79d Move config listing to new command config list 2019-07-23 21:27:05 -04:00
Juan Carlos Mejías Rodríguez
5d723af9fd Move AuthenticateUserRequest and AuthenticateUserResponse to types.go 2019-07-23 18:17:25 -04:00
Juan Carlos Mejías Rodríguez
5664faf2dd Add --list flag to config command to list all available configuration keys 2019-07-23 16:43:40 -04:00
Juan Carlos Mejías Rodríguez
0723ae0eb8 Add config command to get and set configuration options 2019-07-23 16:43:40 -04:00
Juan Carlos Mejías Rodríguez
56d6e1102d Move variable with program name to the top in version.go 2019-07-23 07:10:34 -04:00
Juan Carlos Mejías Rodríguez
fd8b64768c Update Changelog 2019-07-22 09:00:57 -04:00
Juan Carlos Mejías Rodríguez
74ec8c1d22 Add #Contributing section to readme 2019-07-22 08:55:28 -04:00
Juan Carlos Mejías Rodríguez
7877eec67d Add dash separator to version suffix 2019-07-22 01:19:40 -04:00
Juan Carlos Mejías Rodríguez
1b27073491 Add final period to Overview sentence in Readme 2019-07-22 01:10:10 -04:00
Juan Carlos Mejías Rodríguez
6d6928203c Fix debug mode environment variable name in readme 2019-07-21 23:12:11 -04:00
Juan Carlos Mejías Rodríguez
c5b1dfaa82 Rewrite project in Go 2019-07-21 18:49:28 -04:00
Juan Carlos Mejías Rodríguez
3326a0fdda
Add Docker images documentation
Fixes #9
2019-06-10 01:31:34 -04:00
Juan Carlos Mejías Rodríguez
72aba24865
Fix typo in supported API version's documentation 2019-06-10 01:04:20 -04:00
Juan Carlos Mejías Rodríguez
74d35b765e
Update changelog 2019-06-05 11:01:01 -07:00
Juan Carlos Mejías Rodríguez
e9caa803b6
Merge pull request #14 from tortuetorche/patch-2
Fix environment variables who contains spaces in their value
2019-06-05 10:50:32 -07:00
Tortue Torche
e386126466
Use the realpath of the env file to be able to source it
Without this commit:
This command works correctly:
psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g ./env_vars

But this command doesn't work correctly:
psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g env_vars
2019-05-29 10:25:33 +02:00
Tortue Torche
0828e59bc7
Fix environment variables who contains spaces in their value
If you have a `.env` file with some environment variables who contains spaces, like this:

DB_INITIALIZE="cd /app && RAILS_ENV=production bin/setup"
DB_MIGRATE="cd /app && RAILS_ENV=production bin/update"
2019-05-29 09:57:10 +02:00
–Juan Carlos Mejías Rodríguez
79d3b5e775 Add changelog 2019-05-24 04:09:04 -07:00
Juan Carlos Mejías Rodríguez
d90eb42ab5
Merge pull request #8 from tortuetorche/patch-1
Add custom stack environment variables
2019-05-10 20:42:30 -07:00
Juan Carlos Mejías Rodríguez
a692212a9f
Add Dockerfile ENV for stack environment variables 2019-05-10 20:39:15 -07:00
Juan Carlos Mejías Rodríguez
a47e653fae
Add documentation for stack environment variables 2019-05-10 20:32:32 -07:00
Juan Carlos Mejías Rodríguez
b0b59385f1
Make new_stack_envvars local 2019-05-10 20:02:07 -07:00
Tortue Torche
7c5e9e9b57
Add custom stack environment variables
Prior to this pull request `psu` script act like this:
Stack env vars are set in the `deploy()` function. When a new stack is deployed it gets no env vars, and when an existing one is updated its envvars are reused (extracted from its stack definition into the stack_envvars variable and set back again).

For the first case this pull request load the content of the env vars file and transform it into JSON using a `jq` command and set it as the `stack_envvars` value.
For the second case, though, the script update the current stack env vars rather than setting them from scratch, keeping any value not previously set in the env file.

The environment variables file path is customizable with the environment variable `$ENVIRONMENT_VARIABLES_FILE` or the `-g` flag, like this:
```bash
export ACTION="deploy"
export PORTAINER_USER="admin"
export PORTAINER_PASSWORD="password"
export PORTAINER_URL="http://portainer.local"
export PORTAINER_STACK_NAME="mystack"
export DOCKER_COMPOSE_FILE="/path/to/docker-compose.yml"
export ENVIRONMENT_VARIABLES_FILE="/path/to/env_vars_file"

./psu
```

Or with flags:
```bash
./psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g /path/to/env_vars_file
```

close #7
2019-05-10 16:33:49 +02:00
Juan Carlos Mejías Rodríguez
e446fb6b1c
Fix relative links in docs 2018-12-29 10:44:59 -08:00
Juan Carlos Mejías Rodríguez
41fb0f2256 Change Docker entrypoint to /usr/local/bin/psu 2018-11-26 19:24:14 -05:00
Juan Carlos Mejías Rodríguez
14c0e97d85
Add "How to install" section to docs 2018-11-26 14:40:50 -05:00
Juan Carlos Mejías Rodríguez
8a8020d013 Quote usages of $@ 2018-11-26 00:39:43 -05:00
Juan Carlos Mejías Rodríguez
09500d1697 Fix Dockerfile envvar declaration 2018-11-26 00:20:04 -05:00
Juan Carlos Mejías Rodríguez
3d8748d26c Move check_for_errors calls before echo_debug calls 2018-11-26 00:02:06 -05:00
Juan Carlos Mejías Rodríguez
3864db4c2a Separate local variables declaration and assignment for command substitutions 2018-11-26 00:02:03 -05:00