sapics / geoip-country

Less memory usage version of geoip-lite by supporting only country lookup.
Other
89 stars 13 forks source link

Allow storing the database files in a custom directory #15

Closed apfelbox closed 1 year ago

apfelbox commented 1 year ago

Hi,

it would be great if it would be allowed to configure a separate directory for storing the database files in. Our hosting has a readonly-filesystem for everything except specific mounts and I would like to avoid having node_modules completely mutable.

Is that possible? I could try to help with the implementation.

sapics commented 1 year ago

It looks very good feature!

I create a custom-dir branch for this issue. Could you try the branch? You could use custom dir with environment GEODATADIR and TMPDATADIR, or CLI parameter --geodatadir=XXXXXX and --tmpdatadir=XXXXXX.

apfelbox commented 1 year ago

The implementation is looking great, I just pushed some small tweaks in https://github.com/sapics/geoip-country/pull/16

sapics commented 1 year ago

Thank you for checking and fixing bug! I merge to master branch with your commits!

apfelbox commented 1 year ago

Thanks for merging @sapics 🙌

One thing to note is though, that right now, if you install the package with a custom data dir, you need to first update the dbs, as it won't use the bundled ones by default. That might be worth documenting.

Do you already have an ETA for the next release in mind?

sapics commented 1 year ago

Thank you for noticing!

I added the documentation about Custom Directory in README. https://github.com/sapics/geoip-country#custom-directory-for-database-files I hope that the sentense For creating and updating ... explains your concerns. (I am not good at English.)

Currently, this is automatically updated twice a week, so the next update will be made within 48 hours.