upload password in datasource for Postgresql #275
Replies: 2 comments
-
I haven't tested the Postgres data specifically for this. The annoying part with the datasources/connections is that they all have a slightly different behavior. There is no standard way of say setting a username/password. There might be a bug but I need to dig a bit deeper, though even once it's fixed, let me clarify a few things. Anything that is securedata in the payload, specifically "secureJsonData" gets loaded from your exports 'secure/filename.json' that resides in the exports folder. You match the secure data to a connection with the credential_rules. If none match, it'll try to return default.json from the secure folder if one exists. I haven't seen a behavior where basicAuth is false and it has credentials, so will need to do a fix on this. I'm currently only setting secureJSONData when basicAuth is enabled, so GDG currently won't work for your use case. I'll see about getting a quick fix, or if you want to do a MR, the issue is: https://github.com/esnet/gdg/blob/master/internal/service/connections.go#L151 Once that's fixed, I imagine something like: {
"password": "password",
"user": "user"
} Should work. Also, I converted this issue into a conversation and created bug: #276 for the bug in question. |
Beta Was this translation helpful? Give feedback.
-
Actually I misspoke. This works without any changes. Here's my configuration: context_name: testing
contexts:
testing:
output_path: test/data
connections:
credential_rules:
- rules:
- field: "name"
regex: "PostgreSQL"
secure_data: "db.json"
- rules:
- field: "name"
regex: ".*"
secure_data: "default.json"
url: http://localhost:3000
user_name: admin
password: admin
watched:
- General
- Other secure/db.json {
"password": "secret"
} gdg -c config/testing.yml backup c clear
gdg -c config/testing.yml backup upload I confirmed the connection against a docker postgres container was re-created successfully. This is the connection type I'm using:
|
Beta Was this translation helpful? Give feedback.
-
Hello,
I cannot undestand how to secure password for uploading password with Datasource.
example:
I have test datasource for provisioning:
datasource-db1.yaml
apiVersion: 1
datasources:
type: postgres
url: database:6544
database: db1
user: dbuser
secureJsonData:
password: "password"
jsonData:
sslmode: "disable" # disable/require/verify-ca/verify-full
maxOpenConns: 100
postgresVersion: 1209
timescaledb: false
I exported the same and got like this:
{
"access": "proxy",
"id": 33,
"jsonData": {
"database": "db1",
"maxIdleConns": 100,
"maxIdleConnsAuto": true,
"maxOpenConns": 100,
"postgresVersion": 1100,
"sslmode": "disable"
},
"name": "DB1",
"orgId": 1,
"type": "postgres",
"typeLogoUrl": "public/app/plugins/datasource/postgres/img/postgresql_logo.svg",
"typeName": "PostgreSQL",
"uid": "3e3-998d-4f3e-8e40-12bf75c2945d",
"url": "atabase:6544",
"user": "dbuser"
}
without password.
I uploaded the test.json like this
{
"access": "proxy",
"id": 33,
"jsonData": {
"database": "db1",
"maxIdleConns": 100,
"maxIdleConnsAuto": true,
"maxOpenConns": 100,
"postgresVersion": 1100,
"sslmode": "disable"
},
"name": "DB1",
"orgId": 1,
"type": "postgres",
"typeLogoUrl": "public/app/plugins/datasource/postgres/img/postgresql_logo.svg",
"typeName": "PostgreSQL",
"uid": "3e3-998d-4f3e-8e40-12bf75c2945d",
"url": "database:6544",
"user": "dbuser",
"secureJsonData": {
"password": "password"
}
}
but it's not exported with password and I need to set the password manually.
What should I do ?
Do you have any examples for it or like this cases?
Thanks.
PS:
I found pages :
#253
https://software.es.net/gdg/docs/gdg/configuration/#connection
but it's not help me :(
Beta Was this translation helpful? Give feedback.
All reactions