Module: NginxStage::PunConfigView

Included in:
PunConfigGenerator
Defined in:
lib/nginx_stage/views/pun_config_view.rb

Overview

A view used as context for the pun config ERB template file

Instance Method Summary collapse

Instance Method Details

#access_log_pathString

Path to the user’s personal access.log

Returns:

  • (String)

    path to access log


18
19
20
# File 'lib/nginx_stage/views/pun_config_view.rb', line 18

def access_log_path
  NginxStage.pun_access_log_path(user: user)
end

#app_configsArray<String>

Array of wildcard paths to app configs user has access to

Returns:

  • (Array<String>)

    list of wildcard app config paths


84
85
86
87
88
# File 'lib/nginx_stage/views/pun_config_view.rb', line 84

def app_configs
  NginxStage.pun_app_configs(user: user).map do |envmt|
    NginxStage.app_config_path envmt
  end
end

#error_log_pathString

Path to the user’s personal error.log

Returns:

  • (String)

    path to error log


12
13
14
# File 'lib/nginx_stage/views/pun_config_view.rb', line 12

def error_log_path
  NginxStage.pun_error_log_path(user: user)
end

#groupString

Primary group of the user

Returns:

  • (String)

    primary group of user


6
7
8
# File 'lib/nginx_stage/views/pun_config_view.rb', line 6

def group
  user.group
end

#mime_types_pathString

Path to system-installed NGINX mime.types config file

Returns:

  • (String)

    path to system-installed NGINX mime.types config


30
31
32
# File 'lib/nginx_stage/views/pun_config_view.rb', line 30

def mime_types_path
  NginxStage.mime_types_path
end

#passenger_nodejsString

Path to system-installed NodeJS binary

Returns:

  • (String)

    the system-installed NodeJS binary


48
49
50
# File 'lib/nginx_stage/views/pun_config_view.rb', line 48

def passenger_nodejs
  NginxStage.passenger_nodejs
end

#passenger_pythonString

Path to system-installed python binary

Returns:

  • (String)

    the system-installed python binary


54
55
56
# File 'lib/nginx_stage/views/pun_config_view.rb', line 54

def passenger_python
  NginxStage.passenger_python
end

#passenger_rootString

Path to system-installed Passenger locations.ini file

Returns:

  • (String)

    path to Passenger locations.ini


36
37
38
# File 'lib/nginx_stage/views/pun_config_view.rb', line 36

def passenger_root
  NginxStage.passenger_root
end

#passenger_rubyString

Path to system-installed Ruby binary

Returns:

  • (String)

    the system-installed Ruby binary


42
43
44
# File 'lib/nginx_stage/views/pun_config_view.rb', line 42

def passenger_ruby
  NginxStage.passenger_ruby
end

#pid_pathString

Path to the user’s per-user NGINX pid file

Returns:

  • (String)

    path to pid file


24
25
26
# File 'lib/nginx_stage/views/pun_config_view.rb', line 24

def pid_path
  NginxStage.pun_pid_path(user: user)
end

#restart_confirmationString

View used to confirm whether the user wants to restart the PUN to reload configuration changes

Returns:

  • (String)

    restart confirmation view


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/nginx_stage/views/pun_config_view.rb', line 93

def restart_confirmation
  <<-EOF.gsub("'", %q{\\\'})
    <html>
    <head>
      <style>
        body {
          font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
          font-size: 16px;
          line-height: 1.4;
          color: #333;
          font-weight: 300;
          padding: 15px;
        }
        h2 {
          font-weight: 500;
          font-size: 30px;
        }
        .text-danger {
          color: #a94442;
        }
        .btn-danger {
          text-decoration: none;
          font-weight: 400;
          padding: 10px 16px;
          border-radius: 6px;
          color: #fff;
          background-color: #d9534f;
        }
      </style>
    </head>
    <body>
      <h2>
        App has not been initialized or does not exist
      </h2>
      <p class="text-danger">
        This is the first time this app has been launched in your per-user
        NGINX (PUN) server. This requires a configuration change followed
        by a restart of your PUN server. Be sure you save all the work you
        are doing in other apps that have active websocket connections
        (i.e., Shell App) and you complete all file uploads/downloads.
      </p>
      <p>
        Clicking the "Initialize App" button will apply the configuration
        change and restart your per-user NGINX (PUN) server.
      </p>
      <a href="#{app_init_url}" class="btn-danger">Initialize App</a>
    </body>
    </html>
  EOF
end

#sendfile_rootString

Path to the filesystem root where files are served from

Returns:

  • (String)

    path to filesystem root


78
79
80
# File 'lib/nginx_stage/views/pun_config_view.rb', line 78

def sendfile_root
  NginxStage.pun_sendfile_root(user: user)
end

#sendfile_uriString

Internal URI used to access filesystem from apps

Returns:

  • (String)

    the filesystem URI


72
73
74
# File 'lib/nginx_stage/views/pun_config_view.rb', line 72

def sendfile_uri
  NginxStage.pun_sendfile_uri
end

#socket_pathString

Path to the user’s per-user NGINX socket file

Returns:

  • (String)

    path to socket file


66
67
68
# File 'lib/nginx_stage/views/pun_config_view.rb', line 66

def socket_path
  NginxStage.pun_socket_path(user: user)
end

#tmp_rootString

Path to user’s personal tmp root

Returns:

  • (String)

    path to tmp root


60
61
62
# File 'lib/nginx_stage/views/pun_config_view.rb', line 60

def tmp_root
  NginxStage.pun_tmp_root(user: user)
end