Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT created as time, row_number() OVER (ORDER BY created) FROM maevsi_private.account",
"rawSql": "SELECT created_at as time, row_number() OVER (ORDER BY created_at) FROM maevsi_private.account",
"refId": "A",
"sql": {
"columns": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ datasources:
sslmode: 'disable'
name: PostgreSQL
secureJsonData:
password: postgres
password: $__file{/run/secrets/postgres_role_grafana_password}
type: grafana-postgresql-datasource
url: postgres:5432
user: postgres
user: $__file{/run/secrets/postgres_role_grafana_username}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

username="$(cat /run/secrets/postgres_user)"
postgres_user="$(cat /run/secrets/postgres_user)"

create_database_and_role() {
db_name="$1"
Expand All @@ -24,7 +24,7 @@ create_database_and_role() {

echo "[INFO] Creating user and database: '$db_name'"

psql -v ON_ERROR_STOP=1 --username "$username" --dbname "postgres" <<-EOSQL
psql -v ON_ERROR_STOP=1 --username "$postgres_user" --dbname "postgres" <<-EOSQL
CREATE ROLE "$db_username" WITH LOGIN PASSWORD '$db_password';
CREATE DATABASE "$db_name" OWNER "$db_username";
EOSQL
Expand Down