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

Add a config file for easily find or change some settings like status max chars #27833

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

sinoru
Copy link
Sponsor Contributor

@sinoru sinoru commented Nov 13, 2023

Add a config file config/mastodon.yml

At this time, This will contains:

  • accounts.max_featured_tags
  • statuses.max_characters
  • statuses.url_placeholder_chars
  • media_attachments.file_size_limit.image
  • media_attachments.file_size_limit.video
  • media_attachments.max_description_length
  • media_attachments.mime_types
  • polls.max_options
  • polls.max_option_characters

And will be more on later PRs.

This will fixes #25546, #12265 partially.
I found #5697 PR.
but this PR will only introduces a config file, not env. So It can not be easily switching value, not encouraging to change it.
But there are already many servers which fork and change these values. For those, this will make them comfortable.

So this is trying to make middle ground:

  1. Not easily configurable, should fork to change it.
  2. But, Can find and replace it easily.

@sinoru sinoru changed the title Add a config file for easily find or change some settings Add a config file for easily find or change some settings like status max chars Nov 13, 2023
@ClearlyClaire
Copy link
Contributor

Mastodon configuration mostly works either through environment variables (loaded from .env.production) or from the admin interface. I am not sure there is any benefit in introducing a third way.

@sinoru
Copy link
Sponsor Contributor Author

sinoru commented Nov 14, 2023

Mastodon configuration mostly works either through environment variables (loaded from .env.production) or from the admin interface. I am not sure there is any benefit in introducing a third way.

@ClearlyClaire I agree with that, but Gargron doesn't seem to agree on changing things like the status character limit easily (#5697 (comment)), so I used third way, and I think it would be better to manage constants in one file than multiple codes.

@sinoru sinoru closed this Nov 14, 2023
@sinoru sinoru reopened this Nov 14, 2023
@ClearlyClaire
Copy link
Contributor

ClearlyClaire commented Nov 15, 2023

I don't know whether Gargron's position has changed on this, but I do not think introducing a third location for settings would change his mind.

@sinoru
Copy link
Sponsor Contributor Author

sinoru commented Nov 15, 2023

I don't know whether Gargron's position has changed on this, but I do not think introducing a third location for settings would change his mind.

@ClearlyClaire
In my opinion, it is inefficient to refer to or modify const values that are hard coded in various files or codes in development. But everything in .env would be really vast to put all the constant values.
So I think it's better to leave the parts that can be easily set in .env and manage the rest of the constants through mastodon.yml config. What I think about in the future is to include every constants like file size limit and image resolution size, media MIME type, etc.

@sinoru
Copy link
Sponsor Contributor Author

sinoru commented Nov 17, 2023

I added some values for demonstration, examples.
This is not definitely easily configurable values. But, this will make minor server admin happy for who do already did fork for customize this values, can make them easily change, easily merge upstream.

@ClearlyClaire
Copy link
Contributor

Again, I don't think there is a reason to not use env variables for those settings. The fact those limits cannot be changed without changing the source code is on purpose (even though that is something I personally disagree with), so introducing a new config file will not make the changes more likely to be merged.

@sinoru
Copy link
Sponsor Contributor Author

sinoru commented Nov 17, 2023

I don't think there is a reason to not use env variables for those settings.

I can accept it.

The fact those limits cannot be changed without changing the source code is on purpose (even though that is something I personally disagree with)

I introduces new file because of this. (It is just a yml file inside of source code.)

If I create .rb (At least, It is source code.) file include those constants instead of .yml, than It can increase chances of getting be merged?

Copy link
Contributor

github-actions bot commented Apr 2, 2024

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Singular Config for configuration
2 participants