审查员 - PSQL - 使用postgres用户拒绝访问

时间:2016-11-07 03:37:11

标签: postgresql psql access scrutinizer

这是我对Scrutinizer实例的配置:

build:
dependencies:
    before:
        - psql -c 'CREATE DATABASE db_name WITH OWNER scrutinizer;'
        - psql -c "ALTER ROLE postgres WITH PASSWORD 'postgres'"
        - psql -c 'GRANT ALL PRIVILEGES ON DATABASE "db_name" to postgres'
        - cp .env.example .env
project_setup:
    override:
        - true
environment:
    php:
        version: 7.0.6
    node: 4.0
    variables:
        APP_KEY: 'app_key'
        BUGSNAG_API_KEY: 'test'
tests:
    override:
        -   
            command: vendor/bin/phpunit -v --debug --coverage-clover=my-coverage-file --configuration phpunit.xml
            coverage:
                file: my-coverage-file
                format: php-clover

检查:     PHP:         code_rating:true         重复:真实

但我无法使用用户postgres访问psql,任何想法?

Access denied for user 'postgres'@'localhost' (using password: YES) 

1 个答案:

答案 0 :(得分:0)

决议:

在这种情况下,SC无法确定.envphpunit.xml,因此我必须在我的网络测试用例setup方法中指定它:

    putenv('DB_DATABASE=db_name');
    putenv('DB_USERNAME=postgres');
    putenv('DB_PASSWORD=postgres');
    putenv('DB_CONNECTION=pgsql');
    putenv('DB_PORT=5432');

最重要的变量是DB_CONNECTION