Sha256: ceab1e4374efcced68b5b3ac8ef85dadbd86cddea2202617db82479bfb3b9706

Contents?: true

Size: 1.41 KB

Versions: 11

Compression:

Stored size: 1.41 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2024 Eric Crane.  All rights reserved.
#
# Configuration for a gloo web server.
#

module Gloo
  module WebSvr
    class Config

      SCHEME_SEPARATOR = '://'
      HTTP = 'http'
      HTTPS = 'https'
      LOCALHOST = 'localhost'
      PORT_DEFAULT = '8080'
      
      attr_reader :scheme, :host, :port
      

      # ---------------------------------------------------------------------
      #    Initialization
      # ---------------------------------------------------------------------

      #
      # Set up the web server.
      #
      def initialize( scheme = HTTP, host = LOCALHOST, port = PORT_DEFAULT )
        @scheme = scheme
        @host = host
        @port = port
      end


      # ---------------------------------------------------------------------
      #    Static Helper Functions
      # ---------------------------------------------------------------------


      # ---------------------------------------------------------------------
      #    Helper Functions
      # ---------------------------------------------------------------------

      # 
      # The base url, including scheme, host and port.
      # 
      def base_url
        url = "#{self.scheme}#{SCHEME_SEPARATOR}#{self.host}"
        unless self.port.blank? 
          url << ":#{self.port}"
        end
        return url
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gloo-3.10.0 lib/gloo/web_svr/config.rb
gloo-3.9.1 lib/gloo/web_svr/config.rb
gloo-3.9.0 lib/gloo/web_svr/config.rb
gloo-3.8.0 lib/gloo/web_svr/config.rb
gloo-3.7.0 lib/gloo/web_svr/config.rb
gloo-3.6.2 lib/gloo/web_svr/config.rb
gloo-3.6.1 lib/gloo/web_svr/config.rb
gloo-3.6.0 lib/gloo/web_svr/config.rb
gloo-3.5.0 lib/gloo/web_svr/config.rb
gloo-3.4.1 lib/gloo/web_svr/config.rb
gloo-3.4.0 lib/gloo/web_svr/config.rb