simple-maintenance-mode 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a078d20b7bf9b245d3a0ca0158f8cefcb7fba3cd61049ea3db4c2eb94b7d315d
|
4
|
+
data.tar.gz: 6b0b1a2fd65d2bdff317770de88cb85137ecfae3a7d80d817ba10dd57d8abc49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 415dda6ba31c6b8f91ad96bc480253fd9d429f76d60b4988b9cdf117679eee54a3c2a1345245011e46dea1a1b761b50628f7587e14e85f20943837d3c9c65c5d
|
7
|
+
data.tar.gz: e7653aacb426bba403fa3d5a0cea2fd4b3e98404f33e0358ee6d2c463c7b3025f531c81acda3d3e1fdc6e69c31a01a7789877cb6d7f2620d236a79fae11be6f2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -10,11 +10,16 @@ static maintenance mode page (**/maintenance** route). The maintenance mode sett
|
|
10
10
|
will be stored in a app settings model. Additionally each user will get a cookie
|
11
11
|
when the mode is active and a redirection to the maintenance page will happen.
|
12
12
|
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Activating/deactivating the maintenance mode
|
13
16
|
To activate the maintenance mode simply run the rails console and do this:
|
14
17
|
**SimpleMaintenanceMode::Model::AppSettings.maintenance_mode = true**
|
15
18
|
|
16
|
-
|
17
|
-
the **maintenance_mode_override=1** GET parameter.
|
19
|
+
### Overriding maintenance mode for adminis
|
20
|
+
As a rails app administrator, you will be always able to access the page by using the **maintenance_mode_override=1** GET parameter. This will set a cookie and allow administrators to see the app without beeing redirected to the maintenance page. To activate the override access you webapp similar to this: `https://<you-app-domain>/?maintenance_mode_override=1`.
|
21
|
+
|
22
|
+
To remove the override, simply delete the `maintenance_mode_override` cookie.
|
18
23
|
|
19
24
|
|
20
25
|
## Installation
|
@@ -50,4 +55,11 @@ SimpleMaintenanceMode::Model::AppSettings.maintenance_mode
|
|
50
55
|
|
51
56
|
# set maintenance mode
|
52
57
|
SimpleMaintenanceMode::Model::AppSettings.maintenance_mode = true|false
|
58
|
+
|
59
|
+
# use content for custom contents, i.e.
|
60
|
+
SimpleMaintenanceMode::Model::AppSettings.content.maintenance_info = {
|
61
|
+
title: 'This website is in maintenance',
|
62
|
+
message: 'The maintenace will take 10min.'
|
63
|
+
}
|
64
|
+
# later you can use it in
|
53
65
|
````
|
@@ -6,7 +6,9 @@ module SimpleMaintenanceMode
|
|
6
6
|
class AppSettings < ActiveRecord::Base
|
7
7
|
|
8
8
|
acts_as_singleton
|
9
|
-
|
9
|
+
|
10
|
+
store :content, accessors: [ :maintenance_message ], coder: JSON
|
11
|
+
|
10
12
|
def self.maintenance_mode=(active=false)
|
11
13
|
app_settings = SimpleMaintenanceMode::Model::AppSettings.instance
|
12
14
|
app_settings.maintenance_mode = active
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-maintenance-mode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Musial-Bright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|