-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
[bug] Discrepancies in default values in config.yaml and in the code #1964
Comments
Thanks for this! There's definitely a few we need to fix there. In Go, when a value isn't explicitly initialised, you'll get the "zero value" of the type, or nil if it's a pointer. In our case, that means that if you don't explicitly set a value to a string you get the empty string This makes |
Having said that, I realise that there's a whole bunch of places where we do explicitly intialise values to For the ones where we have a default in |
Thank you for detailed response and guidelines 😊 I prepared changes according to our discussion - #1971. I marked my merge request as draft for now as I'd like to propose one improvement - default values could be checked in automatic way as part of CI (similar to I think this check could help in keeping |
would it be possible to generate the go code defaults from the YAML at build time? |
I've been thinking the same, but the other way around. I was hoping to generate The one thing I don't know is how/where to stash the additional prose we have in |
Describe the bug with a clear and concise description of what the bug is.
There are few discrepancies in default values of parameters defined in example/config.yaml and in internal/config/defaults.go.
Here is the list of all discrepancies I've found:
example/config.yaml
internal/config/defaults.go
AdminMediaPruneDryRun: true
advanced-throttling-retry-after: "30s"
block-max-size: 100
BlockMaxSize: 1000
ConfigPath: ""
db-sqlite-busy-timeout: "5m"
DbSqliteBusyTimeout: time.Minute * 30
host: "localhost"
Host: ""
instance-expose-public-timeline: false
InstanceMaxSize: 2000
InstanceSweepFreq: time.Minute
InstanceTTL: time.Minute * 30
oidc-admin-groups: []
smtp-from: ""
SMTPFrom: "GoToSocial"
storage-s3-access-key: ""
storage-s3-bucket: ""
storage-s3-endpoint: ""
storage-s3-secret-key: ""
webfinger-sweep-freq: "1m"
WebfingerSweepFreq: time.Minute * 15
What's your GoToSocial Version?
v0.10.0-rc1
GoToSocial Arch
All are affected
What happened?
Application may act differently for different users if they chose to configure it with or without config.yaml (e.g. using only environment variables or runtime parameters to overwrite hard-coded defaults). This is in regards to items 2, 3, 5, 12 and 17.
Other items may result in rather small inconvenience (user would need to add them to config.yaml to change their default value) - items 1, 8, 9, 10 - or may be perceived as inconsistency in the code - items 7, 11, 13, 14, 15, 16 (e.g. there are other variables declared with empty string value).
What you expected to happen?
I think the default values should be the same no matter which way of configuration user chooses.
How to reproduce it?
No response
Anything else we need to know?
I would gladly work on providing a patch to address these discrepancies.
Please let me know if you see a value in such contribution and if you think that all or maybe only some of them should be aligned :)
The text was updated successfully, but these errors were encountered: