Skip to content

parseInt(HMD_MINIO_PORT) cause another bug #767

@vazontang

Description

@vazontang

Sorry for that my PR #765 does't fix bug #763 perfectly.

The code I wrote in /lib/config/environment.js :

port: parseInt(process.env.HMD_MINIO_PORT)

Cause another bug which make config.minio.port neither default value nor value in config.json while HMD_MINIO_PORT hasn't been defined .

The reason is environment.js is merged after than config.json in /lib/config/index.js .

In addition , lodash.merge only skip undefined value .

However using port: parseInt(process.env.HMD_MINIO_PORT) make value of port isn't undefined but NaN whileprocess.env.HMD_MINIO_PORT is undefined .

And It makes config.minio.port overwrite with NaN even though HMD_MINIO_PORT hasn't been set in env .


Value of port should be undefined when HMD_MINIO_PORT isn't set in ENV to prevent original value be overwrote . And I rewrite code into this to fix it :

port: (process.env.HMD_MINIO_PORT == undefined) ? undefined : parseInt(process.env.HMD_MINIO_PORT)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions