-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fetch conf.yml from server #528
Conversation
Changes preview: |
✔️ Deploy Preview for dashy-dev ready! 🔨 Explore the source changes: d0acd2f 🔍 Inspect the deploy log: https://app.netlify.com/sites/dashy-dev/deploys/6225404187e17d00088ac6b2 😎 Browse the preview: https://deploy-preview-528--dashy-dev.netlify.app/ |
Just reading through the changes now... This is awesome, nicely done :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just maybe it could work client-side, so that it still works when running as static web app. The config file can be fetched directly from axios.get('/conf.yml')
.
Could you also bump the version to 2.0.4
in the package.json
, and add a quick summary to the .github/CHANGELOG.md
Other than that, all good, and solved a big problem, thanks a lot for submitting :)
My bad, Netlify completely bypassed my thoughts when I was looking through the code and thinking about the changes. Doing it client side definitely works, but express serving both the I also just noticed that conf.yml is imported on build in Once I get all that fixed and make sure I haven't missed something like Netlify again, I'll push up the changes. |
Okay, the changes you requested and a few others have been made.
I also realized a problem caused by fetching directly from the client and the fact that the server is serving static files from both
I messed around with it for a bit and pushed a change to the Dockerfile that copies only the needed files for the app to work as a quick example. This lowers the size of the image by ~30mb, but doesn't do anything for an install from source. My solution would be to split the server and frontend into two directories and only copy over the I figured I'd push up what I've got so far and see which you prefer before rearranging anything and writing a build script. Please let me know if I missed anything! And thanks again for this project, I've had a wonderful time working on it and I don't think I could have chosen better for my first contribution to open source! |
src/utils/ConfigAccumalator.js
Outdated
@@ -14,11 +14,11 @@ import { | |||
} from '@/utils/defaults'; | |||
import ErrorHandler from '@/utils/ErrorHandler'; | |||
import { applyItemId } from '@/utils/SectionHelpers'; | |||
import conf from '../../public/conf.yml'; | |||
import $store from '../store'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also use the @
alias for consistency, like: import $store from '@/store';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Just one small thing, can you add the SET_REMOTE_CONFIG
key to the list in StoreMutations.js
. Works fine in production, but I get an undefined error when that's missing in dev. Once that's done, then ready for merge :)
Done, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
Thank you for contributing to Dashy! So that your PR can be handled effectively, please populate the following fields (delete sections that are not applicable)
Category:
Feature
Overview
Fetch the config from a server endpoint. This allows for the conf.yml to be updated without a rebuild and sets a base for possible future config storage options such as a database. This should also allow for the releases to be smaller by not having to include the dev dependencies.
Thanks for this wonderful dashboard!
Code Quality Checklist (Please complete)