Skip to content

Do not hard-code PostgreSQL credentials in tester file #2339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ pipeline:
pull: true
group: test
environment:
PGHOST: pgsql
PGPORT: '5432'
PGUSER: postgres
PGPASSWORD: postgres
TAGS: bindata
GOPATH: /srv/app
commands:
Expand Down
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ TEST_MYSQL_HOST ?= mysql:3306
TEST_MYSQL_DBNAME ?= testgitea
TEST_MYSQL_USERNAME ?= root
TEST_MYSQL_PASSWORD ?=
TEST_PGSQL_HOST ?= pgsql:5432
TEST_PGSQL_DBNAME ?= testgitea
TEST_PGSQL_USERNAME ?= postgres
TEST_PGSQL_PASSWORD ?= postgres

ifeq ($(OS), Windows_NT)
EXECUTABLE := gitea.exe
Expand Down Expand Up @@ -67,7 +63,7 @@ clean:
integrations*.test \
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-sqlite/ \
integrations/indexers-mysql/ integrations/indexers-pgsql integrations/indexers-sqlite \
integrations/mysql.ini integrations/pgsql.ini
integrations/mysql.ini

.PHONY: fmt
fmt:
Expand Down Expand Up @@ -167,11 +163,6 @@ generate-ini:
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
integrations/mysql.ini.tmpl > integrations/mysql.ini
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
integrations/pgsql.ini.tmpl > integrations/pgsql.ini

.PHONY: test-mysql
test-mysql: integrations.test generate-ini
Expand Down
6 changes: 1 addition & 5 deletions integrations/pgsql.ini.tmpl → integrations/pgsql.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ RUN_MODE = prod

[database]
DB_TYPE = postgres
HOST = {{TEST_PGSQL_HOST}}
NAME = {{TEST_PGSQL_DBNAME}}
USER = {{TEST_PGSQL_USERNAME}}
PASSWD = {{TEST_PGSQL_PASSWORD}}
NAME = testgitea
SSL_MODE = disable
PATH = data/gitea.db

[indexer]
ISSUE_INDEXER_PATH = integrations/indexers-pgsql/issues.bleve
Expand Down