Moving mrf settings from instance to separate mrf group
Closes #1631 (closed)
Merge request reports
Activity
- There should be a migration for in-db config
- as @lanodan said, we should support the old config still. Just do something like that in
Pleroma.Config.DeprecationWarnings
@config_map [{[:instance, :rewrite_policy], [:mrf, :policies]}, {[:instance, :mrf_transparency], [:mrf, :transparency]}, {[:instance, :mrf_transparency_exclusions], [:mrf, :transparency_exclusions]}] old_namespaces_detected = Enum.reduce(@config_map, [], fn {old, new} = namespace_change, acc -> old_config = Pleroma.Config.get(old) if old_config do Pleroma.Config.put(new, old_config) [namespace_change | acc] else acc end end) if old_namespaces_detected != [] do # the move points should be generated based on old_namespaces_detected, not implemented because it's hard and this is just an example Logger.warn(""" Your config is using old namespaces for MRF configuration. They should work for now, but you are advised to change to new namespaces to prevent possible issues later: * `config :pleroma, :instance, rewrite_policy` is now `config :pleroma, :mrf, policies` * `config :pleroma, :instance, mrf_transparency` is now `config :pleroma, :mrf, transparency` * `config :pleroma, :instance, mrf_transparency_exclusions` is now `config :pleroma, :mrf, transparency_exclusions` """) end
added 1 commit
- 31ebdf92 - moving mrf settings from instance to separate group
added 1 commit
- 4a711d12 - moving mrf settings from instance to separate group
48 Enum.reduce(old_namespaces_detected, err_msg, fn 49 :rewrite_policy, acc -> 50 acc <> 51 "\n* `config :pleroma, :instance, rewrite_policy` is now `config :pleroma, :mrf, policies`\n" 52 53 :mrf_transparency, acc -> 54 acc <> 55 "\n* `config :pleroma, :instance, mrf_transparency` is now `config :pleroma, :mrf, transparency`" 56 57 :mrf_transparency_exclusions, acc -> 58 acc <> 59 "\n* `config :pleroma, :instance, mrf_transparency_exclusions` is now `config :pleroma, :mrf, transparency_exclusions`" 60 end) 61 62 Logger.warn(err_msg) 63 end Please make this a reusable function we can use for later namespace moves:
def move_namespace_and_warn(namespace_map, warning_preface)
that can be later called like this:
def check_old_mrf_config do move_namespace_and_warn([ {[:instance, :rewrite_policy], [:mrf, :policies]}, {[:instance, :mrf_transparency], [:mrf, :transparency]}, {[:instance, :mrf_transparency_exclusions], [:mrf, :transparency_exclusions]} ], """ !!!DEPRECATION WARNING!!! Your config is using old namespaces for MRF configuration. They should work for now, but you are advised to change to new namespaces to prevent possible issues later: """) end
Edited by rinpatch
added 9 commits
-
4a711d12...fbf02a37 - 8 commits from branch
develop
- 584d6181 - moving mrf settings from instance to separate group
-
4a711d12...fbf02a37 - 8 commits from branch
added 208 commits
-
584d6181...dd4d10b2 - 207 commits from branch
develop
- 8a70e748 - moving mrf settings from instance to separate group
-
584d6181...dd4d10b2 - 207 commits from branch
added 58 commits
-
8a70e748...7ee35eb9 - 57 commits from branch
develop
- 0490abaf - moving mrf settings from instance to separate group
-
8a70e748...7ee35eb9 - 57 commits from branch
changed milestone to %2.1
added 269 commits
-
0490abaf...0dd863f8 - 268 commits from branch
develop
- 0b25e3dd - moving mrf settings from instance to separate group
-
0490abaf...0dd863f8 - 268 commits from branch
added 45 commits
-
0b25e3dd...09563545 - 44 commits from branch
develop
- db531ce0 - moving mrf settings from instance to separate group
-
0b25e3dd...09563545 - 44 commits from branch
added 61 commits
-
db531ce0...07e7c80b - 60 commits from branch
develop
- 03e57625 - moving mrf settings from instance to separate group
-
db531ce0...07e7c80b - 60 commits from branch
added 147 commits
-
03e57625...c74018e6 - 146 commits from branch
develop
- 7af2c112 - moving mrf settings from instance to separate group
-
03e57625...c74018e6 - 146 commits from branch
added 74 commits
-
7af2c112...aeacfb24 - 73 commits from branch
develop
- 470d4150 - moving mrf settings from instance to separate group
-
7af2c112...aeacfb24 - 73 commits from branch
added 567 commits
-
470d4150...8bfacffa - 566 commits from branch
develop
- ed189568 - moving mrf settings from instance to separate group
-
470d4150...8bfacffa - 566 commits from branch
4 4 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). 5 5 6 6 ## [unreleased] 7 8 7 ### Changed 9 8 - MFR policy to set global expiration for all local Create activities 10 9 - OGP rich media parser merged with TwitterCard 10 - Configuration: `rewrite_policy` renamed to `policies` and moved from `instance` to `mrf` group. Old config namespace is deprecated. 11 - Configuration: `mrf_transparency` renamed to `transparency` and moved from `instance` to `mrf` group. Old config namespace is deprecated. 12 - Configuration: `mrf_transparency_exclusions` renamed to `transparency_exclusions` and moved from `instance` to `mrf` group. Old config namespace is deprecated. 13 I think it would be more readable to have it be done in one step like:
:instance, rewrite_policy
moved to:mrf, policies
, how you did in the deprecation messages could be just copy-pasted there.Edited by Haelwenn
Please register or sign in to reply