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

feat: provide OS API keys as properties, rather than env vars #29

Merged
merged 5 commits into from
Aug 12, 2021

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Aug 10, 2021

Adds configurable properties for specifying OS API keys.

Also cleans up naming throughout to hopefully make OS-related services a bit more clear & consistent. I've defined a property per OS API for now, even though some end users may have a single key that can access both/any.

Closes #21

@netlify
Copy link

netlify bot commented Aug 10, 2021

✔️ Deploy Preview for oslmap ready!

🔨 Explore the source changes: 8e55654

🔍 Inspect the deploy log: https://app.netlify.com/sites/oslmap/deploys/6113b09e7950c400075686a0

😎 Browse the preview: https://deploy-preview-29--oslmap.netlify.app

@@ -84,17 +85,27 @@ export class MyMap extends LitElement {
@property({ type: Number })
geojsonBuffer = 12;

private useVectorTiles =
Boolean(import.meta.env.VITE_APP_ORDNANCE_SURVEY_KEY) &&
osVectorTileBaseMap;
Copy link
Member Author

@jessicamcinchak jessicamcinchak Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a bit confusing: I originally thought useVectorTiles could use lit's @state() decorator and be an internal reactive property, but since it now references other configurable property values, it has to be defined within firstUpdated() to evaluate correctly!

@jessicamcinchak
Copy link
Member Author

Netlify failing because env vars have been renamed & are not yet updated under "deploy settings" -- will fix after review depending if we decide to keep env vars as default prop values or remove them altogether!

@jessicamcinchak jessicamcinchak marked this pull request as ready for review August 11, 2021 06:45
@jessicamcinchak
Copy link
Member Author

jessicamcinchak commented Aug 11, 2021

Update: now using .env.development.local instead of .env.local - as this prevents our personal API keys from getting bundled with the production build (when running ENVIRONMENT=production pnpm build at least).

I realized a big perk of not removing env vars all together is that then we can set them in Netlify & maintain preview links with full OS styles and features.

End users should still specify all keys as props. I cleaned up the readme examples to remove mention of env vars!

Copy link
Contributor

@johnrees johnrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo! Great stuff! A+ would review again

@jessicamcinchak jessicamcinchak merged commit 7de15ba into main Aug 12, 2021
@jessicamcinchak jessicamcinchak deleted the jess/api-key-properties branch August 12, 2021 06:41
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

Successfully merging this pull request may close these issues.

Provide OS keys via props rather than ENV vars
2 participants