Skip to content
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

Port value in config-default.json is not used #26

Closed
bandtank opened this issue May 22, 2024 · 1 comment
Closed

Port value in config-default.json is not used #26

bandtank opened this issue May 22, 2024 · 1 comment

Comments

@bandtank
Copy link
Contributor

The initial configuration does not copy every field from config-default.json. Specifically, if the database port is 3307 instead of 3306, for example, the installation will fail at merge_configs.php.

With this configuration:

    "database": {
        "host": "127.0.0.1",
        "port": "3307",
        "charset": "utf8mb4",
        "dbname": "ext-test-extension",
        "user": "root",
        "password": "root"
    },

This is what showed up in the Espo log:

[2024-05-22 19:21:35] ERROR: Uncaught Exception PDOException: "SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)" at ...

However, this works:

    "database": {
        "host": "127.0.0.1:3307",
        "port": "",
        "charset": "utf8mb4",
        "dbname": "ext-test-extension",
        "user": "root",
        "password": "root"
    },

build.js in espocrm-extension-tools does not explicitly use the port value:

        cp.execSync(
            "php install/cli.php -a setupConfirmation -d \"host-name=" + config.database.host +
            "&db-name=" + config.database.dbname +
            "&db-platform=" + dbPlatform +
            "&db-user-name=" + config.database.user +
            "&db-user-password=" + config.database.password + "\"",
            {cwd: cwd + '/site'}
        );

It is confusing for the port setting to be included in config-default.json if it is not actually used in the PHP setup files. E.g. from setupConfirmation.php:

$dbConfig = [
    'host' => $hostData[0] ?? '',
    'port' => $hostData[1] ?? '',
    'dbname' => $installData['db-name'],
    'user' => $installData['db-user-name'],
    'password' => $installData['db-user-password'],
    'platform' => $installData['db-platform'] ?? null,
];

I would expect there to be fields called db-host and db-port or for the port field to be removed from config-default.json.

@bandtank bandtank mentioned this issue May 22, 2024
@yurikuzn
Copy link
Collaborator

Concatenating host and port should solve the problem: espocrm/extension-tools@84196f3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants