chrisvel / wreeto_official

Wreeto is an open source note-taking, knowledge management and wiki system.
https://wreeto.com
GNU Affero General Public License v3.0
387 stars 13 forks source link

Omit `WREETO_PORT` for behind the reverse proxy setup #52

Closed m0nhawk closed 3 years ago

m0nhawk commented 3 years ago

I really liked Wreeto, the only thing I'm having issue is WREETO_PORT.

The logo points to http://my.domain:8383/, and because I'm running everything behind Traefik, I'd like it to point to https://my.domain/ – with https and without the port part.

But I can't figure out how to do that.

As I understand, it's not supported from here. If I understand correctly, it can be patched like this:

module Utils 
  module BaseConfig 

    def base_url
      host = ENV["WREETO_HOST"] || 'localhost'
      port = ENV["WREETO_PORT"] || 8383
      behind_proxy = ENV["BEHIND_PROXY"] || 'no'
      protocol = ENV["PROTOCOL"] || 'http'
      if behind_proxy == 'yes'
        "#{protocol}://#{host}"
      else
        "#{protocol}://#{host}:#{port}"
      end
    end
  end 
end