Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ libpqrcv_connect(const char *conninfo, bool logical, bool must_use_password,
/* BEGIN_NEON */
const char *keys[7];
const char *vals[7];
char * neon_auth_token = NULL;
/* END_NEON */
int i = 0;

Expand All @@ -159,16 +158,14 @@ libpqrcv_connect(const char *conninfo, bool logical, bool must_use_password,
/* BEGIN_NEON */
if (pg_strcasecmp(appname, "walreceiver") == 0)
{
neon_auth_token = getenv("NEON_AUTH_TOKEN");
if (neon_auth_token != NULL)
if (neon_storage_auth_token[0] != '\0')
{
elog(LOG, "Use NEON_AUTH_TOKEN to connect");
keys[++i] = "password";
vals[i] = neon_auth_token;
vals[i] = neon_storage_auth_token;
}
else
{
elog(LOG, "NEON_AUTH_TOKEN is undefined in the environment");
elog(LOG, "no storage authentication token set");
}
}
/* END_NEON */
Expand Down
1 change: 1 addition & 0 deletions src/backend/replication/walreceiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
int wal_receiver_status_interval;
int wal_receiver_timeout;
bool hot_standby_feedback;
char *neon_storage_auth_token;

/* libpqwalreceiver connection */
static WalReceiverConn *wrconn = NULL;
Expand Down
13 changes: 13 additions & 0 deletions src/backend/utils/misc/guc_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include "replication/logicallauncher.h"
#include "replication/slot.h"
#include "replication/syncrep.h"
#include "replication/walreceiver.h"
#include "storage/bufmgr.h"
#include "storage/large_object.h"
#include "storage/pg_shmem.h"
Expand Down Expand Up @@ -4639,6 +4640,18 @@ struct config_string ConfigureNamesString[] =
check_restrict_nonsystem_relation_kind, assign_restrict_nonsystem_relation_kind, NULL
},


{
{"neon_storage_auth_token", PGC_SUSET, REPLICATION_STANDBY,
"Authentication token for Neon storage",
NULL,
GUC_SUPERUSER_ONLY
},
&neon_storage_auth_token,
"",
NULL, NULL, NULL
},

/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL, NULL
Expand Down
1 change: 1 addition & 0 deletions src/include/replication/walreceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
extern PGDLLIMPORT int wal_receiver_status_interval;
extern PGDLLIMPORT int wal_receiver_timeout;
extern PGDLLIMPORT bool hot_standby_feedback;
extern PGDLLIMPORT char *neon_storage_auth_token;

/*
* MAXCONNINFO: maximum size of a connection string.
Expand Down