POSTGRES_PASSWORD=root
PGADMIN_DEFAULT_EMAIL=admin@admin.com
PGADMIN_DEFAULT_PASSWORD=admin
-POSTGRES_DB=erp24
\ No newline at end of file
+POSTGRES_DB=erp24
+POSTGRES_HOSTNAME=db-pgsql-yii_erp24
+POSTGRES_PORT=5432
+POSTGRES_SCHEMA=erp24
\ No newline at end of file
<?php
-return [
+return 1 == 2 ? [
+ 'class' => yii\db\Connection::class,
+ 'dsn' => strtr('pgsql:host={host};port={port};dbname={dbname}', [
+ '{host}' => getenv('POSTGRES_HOSTNAME') ?: '127.0.0.1',
+ '{port}' => getenv('POSTGRES_PORT') ?: 3306,
+ '{dbname}' => getenv('POSTGRES_SCHEMA') ?: 'erp24',
+ ]),
+ 'username' => getenv('POSTGRES_USER') ?: 'bazacvetov24',
+ 'password' => getenv('POSTGRES_PASSWORD') ?: 'JVJruro_Xdg456o3ir',
+ 'schemaMap' => [
+ 'pgsql' => [
+ 'class' => 'yii\db\pgsql\Schema',
+ 'defaultSchema' => 'erp24' //specify your schema here, public is the default schema
+ ]
+ ], // PostgreSQL
+// 'charset' => 'utf8',
+// 'enableSchemaCache' => true,
+// 'schemaCacheDuration' => 300,
+]: [
'class' => yii\db\Connection::class,
'dsn' => strtr('mysql:host={host};port={port};dbname={dbname}', [
'{host}' => getenv('DB_HOST') ?: '127.0.0.1',
$app = (new yii\web\Application($config));
$app->params['API2_TOKEN'] = $app->db->createCommand(
- 'SELECT access_token FROM api_user WHERE login="erp" LIMIT 1;')->queryAll()[0]['access_token'] ?? null;
+ 'SELECT access_token FROM api_user WHERE "login"=\'erp\' LIMIT 1;')->queryAll()[0]['access_token'] ?? null;
$app->run();