Permalink
Browse files

Finally. psql now fetches password directly from a local working AWS …

…CLI and uses that to login to redshift! Woohoo!
  • Loading branch information...
robins committed Oct 12, 2017
1 parent d699938 commit d6d8228b11be75f1f4b5ec67c0f0109fbcc90730
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/bin/psql/common.c
View
@@ -133,8 +133,8 @@ request_password_from_external_source(char **username, char **password)
strcpy(filebuffer, " ");
/* Open the command for reading. */
//fp = popen("aws redshift get-cluster-credentials --db-user redshift2 --cluster-identifier redshift2", "r");
fp = popen("cat /home/pi/projects/postgres/src/bin/psql/cluster.txt", "r");
fp = popen("aws redshift get-cluster-credentials --db-user redshift2 --cluster-identifier redshift2", "r");
//fp = popen("cat /home/pi/projects/postgres/src/bin/psql/cluster.txt", "r");
if (fp == NULL)
{
psql_error("Failed to run AWS CLI to fetch IAM authentication: \n");
@@ -160,8 +160,6 @@ request_password_from_external_source(char **username, char **password)
jsmn_parser p;
jsmntok_t t[128]; /* We expect no more than 128 tokens */
printf("\n===Enter Function===\n");
jsmn_init(&p);
r = jsmn_parse(&p, filebuffer, strlen(filebuffer), t, sizeof(t)/sizeof(t[0]));
if (r < 0) {

0 comments on commit d6d8228

Please sign in to comment.