-
Notifications
You must be signed in to change notification settings - Fork 28
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!: db driven platform settings #1110
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1110 +/- ##
==========================================
- Coverage 68.08% 68.08% -0.01%
==========================================
Files 394 410 +16
Lines 13287 13691 +404
==========================================
+ Hits 9047 9321 +274
- Misses 3731 3836 +105
- Partials 509 534 +25
|
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.
was running it locally and playing with the interval. i set it to one minute1. however, any change to settings i would make (i was using clone image in this case) would always immediately apply.
Footnotes
-
{"level":"info","msg":"refreshing platform settings every 1m0s","time":"2024-05-10T13:22:27Z"}
↩
that makes sense, |
dang it. i swear i looked there and thought it just updated DB, not the in-memory settings 😲 i will run through it again. sorry. i think we should make a note somewhere. what if folks want to use the interval as a safety-buffer. you know, to allow time for undoing an accidental change? that wouldn't be possible in this set up. arguably an edge case? |
seems like an edge case but i can totally understand the confusion. i mean it would be extremely easy to just use a different pointer and let the loop refresh it in the background, i suppose at least it would make things consistent/more straightforward. ill make the tweak |
Yes, I guess the more impactful scenario is that the bigger the interval the longer you will see inconsistent behavior because only one server will have the update (which makes a perhaps unreasonable assumptions that all servers start at the same time). Thanks! But maybe I'm making an elephant out of a mosquito here 😅 |
heres the update: 4cad3e6 i'll let you make the call on keeping it or reverting it. i dont mind either way. |
i like the change. i think that is expected behaviour in a single instance scenario and it gives you the option of close consistency in multi-server scenario. thank you! |
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.
nice work 😍
|
||
// FromAPI converts the API Settings type | ||
// to a database Settings type. | ||
func FromAPI(s *settings.Platform) *Platform { |
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.
func FromAPI(s *settings.Platform) *Platform { | |
func SettingsFromAPI(s *settings.Platform) *Platform { |
Sorry just caught this. Need to have the resource part of the name if they are all in the types
package.
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.
cool cool lemme tweak it
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.
Will address in follow up PR
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.
#1126 🙇
see: go-vela/community#921
introduces some new admin api endpoints
api/v1/admin/settings
GET PUT to retrieve and updateapi/v1/admin/settings
DELETE to "restore" the settings record to the original values stored in the server environmentNOTE: more fields need to be migrated, this is not an exhaustive implementation!