reyemtm / agol-cache

A NodeJS script to download all layers within a public or protected ArcGIS Online Feature or Map Service as GeoJSON.
https://www.npmjs.com/package/agol-cache
MIT License
7 stars 4 forks source link

Support passing `token` #18

Open stevage opened 5 months ago

stevage commented 5 months ago

The only way to pass the token seems to be through the environment variable TOKEN. That's a bit inconvenient if you're using this library on more than one site...

reyemtm commented 5 months ago

This project while in use in a few production applications is not something I've been actively maintaining. There are lots of potential improvements. If I have a chance to work on it I'll definitely add more ways to use a token.

reyemtm commented 5 months ago

I have a few pending updates, maybe this will make it in. gdal3.js output to various formats is the major update in the next version.

reyemtm commented 5 months ago

looks like you're not the first person to raise this - I already have this in my pending updates -

    token: env && env.TOKEN ? env.TOKEN : options && options.token ? options.token : null, //token to use for secured routes,
stevage commented 5 months ago

Nice :) I think it should be the other way around though, so the passed option overrides environment variables:

token: options?.token ?? env.TOKEN