Use config_for for Mastodon::Version metadata/prerelease values (#33548)
				
					
				
			This commit is contained in:
		
							parent
							
								
									2cfc2a777a
								
							
						
					
					
						commit
						34cd7d6585
					
				@ -2,3 +2,6 @@
 | 
				
			|||||||
shared:
 | 
					shared:
 | 
				
			||||||
  self_destruct_value: <%= ENV.fetch('SELF_DESTRUCT', nil) %>
 | 
					  self_destruct_value: <%= ENV.fetch('SELF_DESTRUCT', nil) %>
 | 
				
			||||||
  software_update_url: <%= ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check') %>
 | 
					  software_update_url: <%= ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check') %>
 | 
				
			||||||
 | 
					  version:
 | 
				
			||||||
 | 
					    metadata: <%= ENV.fetch('MASTODON_VERSION_METADATA', nil) %>
 | 
				
			||||||
 | 
					    prerelease: <%= ENV.fetch('MASTODON_VERSION_PRERELEASE', nil) %>
 | 
				
			||||||
 | 
				
			|||||||
@ -21,11 +21,11 @@ module Mastodon
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def prerelease
 | 
					    def prerelease
 | 
				
			||||||
      ENV['MASTODON_VERSION_PRERELEASE'].presence || default_prerelease
 | 
					      version_configuration[:prerelease].presence || default_prerelease
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def build_metadata
 | 
					    def build_metadata
 | 
				
			||||||
      ENV.fetch('MASTODON_VERSION_METADATA', nil)
 | 
					      version_configuration[:metadata]
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def to_a
 | 
					    def to_a
 | 
				
			||||||
@ -77,5 +77,9 @@ module Mastodon
 | 
				
			|||||||
    def user_agent
 | 
					    def user_agent
 | 
				
			||||||
      @user_agent ||= "Mastodon/#{Version} (#{HTTP::Request::USER_AGENT}; +http#{Rails.configuration.x.use_https ? 's' : ''}://#{Rails.configuration.x.web_domain}/)"
 | 
					      @user_agent ||= "Mastodon/#{Version} (#{HTTP::Request::USER_AGENT}; +http#{Rails.configuration.x.use_https ? 's' : ''}://#{Rails.configuration.x.web_domain}/)"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def version_configuration
 | 
				
			||||||
 | 
					      Rails.configuration.x.mastodon.version
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user