hephaestus 0.6.0 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +19 -0
- data/lib/hephaestus/actions/strip_comments_action.rb +1 -1
- data/lib/hephaestus/app_builder.rb +4 -1
- data/lib/hephaestus/generators/config_generator.rb +1 -1
- data/lib/hephaestus/version.rb +1 -1
- data/templates/.github/.DS_Store +0 -0
- data/templates/.github/workflows/test.yml +3 -1
- data/templates/Dockerfile +1 -1
- data/templates/Gemfile.erb +3 -3
- data/templates/app/lib/body_parameter/yetto_parameters.rb +47 -40
- data/templates/app/lib/plug_app/middleware/openapi_validation.rb +55 -26
- data/templates/compose.yml +0 -2
- data/templates/config/initializers/cors.rb +1 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json +59 -110
- data/templates/vendor/fly/fly-production.toml +12 -0
- data/templates/vendor/fly/fly-staging.toml +12 -0
- metadata +9 -12
- data/templates/app/lib/plug_app/middleware/not_found.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ee150804d80090a603c52698b45937f96bbd8bf52d13f295f68471831b2e69b
|
4
|
+
data.tar.gz: de6060aa80ddfd82cc2d122cb8c0b941c1fd6fa70fce4d44190aec6ff91ad779
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b022f681eccc353d032f1f5799b8412d13d69dbcfdbc080d526d2f8f40817c44653f77ef9f901449c1b6fcd658f187bf6092fb54e32e3df8b60ad8b321e7720
|
7
|
+
data.tar.gz: 8c95113092f22e23f201c17d0bef1ff71cfb7ad10f5ef44acd6370f847f69970e980ceae58e8f697bbd9427fdc5bd9196b68d68b5c84885987701520275baf7a
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
# [v0.6.2] - 19-06-2024
|
2
|
+
## What's Changed
|
3
|
+
* Use Ruby test suite by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/18
|
4
|
+
* Catch up with plug updates by @balevine in https://github.com/yettoapp/hephaestus/pull/17
|
5
|
+
|
6
|
+
|
7
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.1...v0.6.2
|
8
|
+
## [v0.6.1] - 12-02-2024
|
9
|
+
## What's Changed
|
10
|
+
* Port recent Ruby, TOML, and OpenAPI changes by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/16
|
11
|
+
|
12
|
+
|
13
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.0...v0.6.1
|
14
|
+
## [v0.6.0] - 19-12-2023
|
15
|
+
## What's Changed
|
16
|
+
* Remove switch logic from plugs by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/15
|
17
|
+
|
18
|
+
|
19
|
+
**Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.5.2...v0.6.0
|
1
20
|
## [v0.5.2] - 13-11-2023
|
2
21
|
## What's Changed
|
3
22
|
* Fix RAILS_ENV in fly-staging.toml by @balevine in https://github.com/yettoapp/hephaestus/pull/13
|
@@ -158,10 +158,13 @@ module Hephaestus
|
|
158
158
|
def replace_generic_variables
|
159
159
|
say(set_color("Replacing generic variable names...", :cyan))
|
160
160
|
replace_in_files(destination_root, /App(?!lication)/, short_app_name.capitalize)
|
161
|
+
|
161
162
|
replace_in_files(destination_root, %r{(?<!yetto|sw|plugs\.yetto\.)app(?!lication|/|roximate)}, short_app_name.downcase)
|
163
|
+
replace_in_file("test/support/api.rb", "/app/", "/#{short_app_name.downcase}/")
|
164
|
+
|
162
165
|
replace_in_files(destination_root, "PlugApp", app_name.underscore.camelcase)
|
163
166
|
replace_in_files(destination_root, "plug-app", app_name.dasherize)
|
164
|
-
replace_in_files("destination_root}/.github/workflows
|
167
|
+
replace_in_files("#{destination_root}/.github/workflows", "plug-app", app_name.dasherize)
|
165
168
|
replace_in_files(destination_root, "PLUG_APP", app_name.underscore.upcase)
|
166
169
|
replace_in_files(destination_root, "plug_app", app_name.underscore)
|
167
170
|
|
@@ -29,7 +29,7 @@ module Hephaestus
|
|
29
29
|
raltie_overload = <<~CONFIG
|
30
30
|
|
31
31
|
# Load dotenv only in development environment
|
32
|
-
Dotenv::
|
32
|
+
Dotenv::Rails.overwrite = true if Rails.env.development?
|
33
33
|
CONFIG
|
34
34
|
inject_into_file(
|
35
35
|
"config/application.rb",
|
data/lib/hephaestus/version.rb
CHANGED
Binary file
|
@@ -6,9 +6,11 @@ on:
|
|
6
6
|
|
7
7
|
jobs:
|
8
8
|
ruby:
|
9
|
-
uses: yettoapp/actions/.github/workflows/
|
9
|
+
uses: yettoapp/actions/.github/workflows/rails_test_suite.yml@main
|
10
10
|
secrets:
|
11
11
|
gh_token: ${{ secrets.GH_SISYPHUS_YETTO_REPO_TOKEN }}
|
12
|
+
with:
|
13
|
+
system_tests: false
|
12
14
|
|
13
15
|
docker:
|
14
16
|
uses: yettoapp/actions/.github/workflows/test_dockerbuild.yml@main
|
data/templates/Dockerfile
CHANGED
data/templates/Gemfile.erb
CHANGED
@@ -27,7 +27,7 @@ gem "hiredis", "~> 0.6"
|
|
27
27
|
gem "lograge", "~> 0.12"
|
28
28
|
|
29
29
|
# provides middleware to make OpenAPI parsing simpler
|
30
|
-
gem "openapi_first", "~> 0
|
30
|
+
gem "openapi_first", "~> 1.0"
|
31
31
|
|
32
32
|
# For Honeycomb.io
|
33
33
|
gem "opentelemetry-sdk", "~> 1.2"
|
@@ -68,7 +68,7 @@ group :development, :test do
|
|
68
68
|
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
69
69
|
gem "debug", platforms: [:mri, :mingw, :x64_mingw], require: false
|
70
70
|
|
71
|
-
gem "faker", "~>
|
71
|
+
gem "faker", "~> 3.0"
|
72
72
|
gem "rubocop", require: false
|
73
73
|
gem "rubocop-standard", require: false
|
74
74
|
end
|
@@ -113,7 +113,7 @@ group :test do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
group :ci do
|
116
|
-
gem "brakeman", "~>
|
116
|
+
gem "brakeman", "~> 6.0"
|
117
117
|
gem "bundle-audit", "~> 0.1"
|
118
118
|
end
|
119
119
|
|
@@ -7,116 +7,123 @@ module BodyParameter
|
|
7
7
|
|
8
8
|
sig { returns(String) }
|
9
9
|
def bparam_organization_id
|
10
|
-
plug_installation_params[:organization][:id]
|
10
|
+
plug_installation_params[:yetto][:organization][:id]
|
11
11
|
end
|
12
12
|
|
13
13
|
sig { returns(String) }
|
14
14
|
def bparam_inbox_id
|
15
|
-
plug_installation_params[:inbox][:id]
|
15
|
+
plug_installation_params[:yetto][:inbox][:id]
|
16
16
|
end
|
17
17
|
|
18
18
|
sig { returns(String) }
|
19
19
|
def bparam_plug_installation_id
|
20
|
-
plug_installation_params[:plug_installation][:id]
|
20
|
+
plug_installation_params[:yetto][:plug_installation][:id]
|
21
21
|
end
|
22
22
|
|
23
23
|
sig { returns(String) }
|
24
24
|
def bparam_plug_id
|
25
|
-
plug_installation_params[:plug][:id]
|
25
|
+
plug_installation_params[:yetto][:plug][:id]
|
26
26
|
end
|
27
27
|
|
28
28
|
sig { returns(T::Hash[Symbol, String]) }
|
29
29
|
def bparam_plug_installation_settings
|
30
|
-
plug_installation_params[:plug_installation][:settings]
|
30
|
+
plug_installation_params[:yetto][:plug_installation][:settings]
|
31
31
|
end
|
32
32
|
|
33
33
|
sig { returns(T::Hash[Symbol, String]) }
|
34
34
|
def plug_installation_params
|
35
35
|
return {} if params.blank?
|
36
36
|
|
37
|
-
|
37
|
+
yetto_params = params.fetch(:yetto, {})
|
38
|
+
plug_installation = yetto_params.fetch(:plug_installation, {})
|
39
|
+
|
38
40
|
plug_installation_id = plug_installation.fetch(:id, "")
|
39
41
|
settings = plug_installation.fetch(:settings, {}).to_unsafe_hash
|
40
42
|
|
41
|
-
organization_id =
|
42
|
-
plug_id =
|
43
|
-
inbox_id =
|
43
|
+
organization_id = yetto_params.fetch(:organization, {}).fetch(:id, "")
|
44
|
+
plug_id = yetto_params.fetch(:plug, {}).fetch(:id, "")
|
45
|
+
inbox_id = yetto_params.fetch(:inbox, {}).fetch(:id, "")
|
44
46
|
|
45
47
|
{
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
yetto: {
|
49
|
+
plug_installation: {
|
50
|
+
id: plug_installation_id,
|
51
|
+
settings: settings,
|
52
|
+
},
|
53
|
+
organization: {
|
54
|
+
id: organization_id,
|
55
|
+
},
|
56
|
+
plug: {
|
57
|
+
id: plug_id,
|
58
|
+
},
|
59
|
+
inbox: {
|
60
|
+
id: inbox_id,
|
61
|
+
},
|
58
62
|
},
|
59
63
|
}
|
60
64
|
end
|
61
65
|
|
62
66
|
sig { returns(String) }
|
63
67
|
def bparam_message_id
|
64
|
-
message_params[:message][:id]
|
68
|
+
message_params[:yetto][:message][:id]
|
65
69
|
end
|
66
70
|
|
67
71
|
sig { returns(String) }
|
68
72
|
def bparam_message_text_content
|
69
|
-
message_params[:message][:text_content]
|
73
|
+
message_params[:yetto][:message][:text_content]
|
70
74
|
end
|
71
75
|
|
72
76
|
sig { returns(String) }
|
73
77
|
def bparam_message_conversation_id
|
74
|
-
message_params[:message][:conversation][:id]
|
78
|
+
message_params[:yetto][:message][:conversation][:id]
|
75
79
|
end
|
76
80
|
|
77
81
|
sig { returns(String) }
|
78
82
|
def bparam_message_conversation_title
|
79
|
-
message_params[:message][:conversation][:title]
|
83
|
+
message_params[:yetto][:message][:conversation][:title]
|
80
84
|
end
|
81
85
|
|
82
86
|
sig { returns(String) }
|
83
87
|
def bparam_message_author_name
|
84
|
-
message_params[:message].fetch(:author, {}).fetch(:name, "Noone")
|
88
|
+
message_params[:yetto][:message].fetch(:author, {}).fetch(:name, "Noone")
|
85
89
|
end
|
86
90
|
|
87
91
|
sig { returns(T::Hash[Symbol, String]) }
|
88
92
|
def bparam_message_metadata
|
89
|
-
message_params[:message][:metadata]
|
93
|
+
message_params[:yetto][:message][:metadata]
|
90
94
|
end
|
91
95
|
|
92
96
|
sig { returns(T::Hash[Symbol, String]) }
|
93
97
|
def message_params
|
94
98
|
return {} if params.blank?
|
95
99
|
|
96
|
-
|
100
|
+
yetto_params = params.fetch(:yetto, {})
|
101
|
+
message = yetto_params.fetch(:message, {})
|
97
102
|
message_id = message.fetch(:id, "")
|
98
103
|
text_content = message.fetch(:text_content, "")
|
99
104
|
conversation = message.fetch(:conversation, {})
|
100
105
|
conversation_id = conversation.fetch(:id, "")
|
101
106
|
title = conversation.fetch(:title, "")
|
102
|
-
|
107
|
+
created_by_membership = message.fetch(:created_by_membership, {})
|
103
108
|
created_by_plug = message.fetch(:created_by_plug, {})
|
104
|
-
author =
|
109
|
+
author = created_by_membership.fetch(:user) || created_by_plug
|
105
110
|
name = author.fetch(:name, "")
|
106
111
|
metadata = message.fetch(:metadata, {}).to_unsafe_hash
|
107
112
|
|
108
113
|
{
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
114
|
+
yetto: {
|
115
|
+
message: {
|
116
|
+
id: message_id,
|
117
|
+
text_content: text_content,
|
118
|
+
conversation: {
|
119
|
+
id: conversation_id,
|
120
|
+
title: title,
|
121
|
+
},
|
122
|
+
author: {
|
123
|
+
name: name,
|
124
|
+
},
|
125
|
+
metadata: metadata,
|
118
126
|
},
|
119
|
-
metadata: metadata,
|
120
127
|
},
|
121
128
|
}
|
122
129
|
end
|
@@ -12,42 +12,71 @@ module PlugApp
|
|
12
12
|
|
13
13
|
def initialize(app)
|
14
14
|
@app = app
|
15
|
-
@response_validator = OpenapiFirst::ResponseValidator.new(SPEC)
|
16
|
-
@request_validator = OpenapiFirst::RequestValidation.new(->(_env) {}, spec: SPEC, raise_error: true)
|
17
15
|
end
|
18
16
|
|
19
17
|
def call(env)
|
20
18
|
request = Rack::Request.new(env)
|
21
19
|
|
22
|
-
|
20
|
+
return @app.call(env) unless request.path.starts_with?(API_PATH_PREFIX) && request.path.exclude?("/settings")
|
21
|
+
|
22
|
+
begin
|
23
23
|
# force content-type to JSON
|
24
|
-
if env["CONTENT_TYPE"]
|
25
|
-
|
26
|
-
|
24
|
+
env["CONTENT_TYPE"] = "application/json" if env["CONTENT_TYPE"] != "application/json"
|
25
|
+
|
26
|
+
validated_request = SPEC.validate_request(request)
|
27
|
+
|
28
|
+
return @app.call(env) if validated_request.valid?
|
29
|
+
|
30
|
+
case validated_request.error
|
31
|
+
when OpenapiFirst::Schema::ValidationError
|
32
|
+
error_arr = format_arr(validated_request.error.errors.map(&:error))
|
33
|
+
Rails.logger.error(error_arr) if print_user_api_errors?
|
34
|
+
[PlugApp::HTTP::BAD_REQUEST_I, { "Content-Type" => "application/json" }, [error_arr]]
|
35
|
+
else
|
36
|
+
case validated_request.error.error_type
|
37
|
+
when :not_found
|
38
|
+
[PlugApp::HTTP::NOT_FOUND_I, { "Content-Type" => "application/json" }, [format_str("Not Found")]]
|
39
|
+
else
|
40
|
+
error_message = if validated_request.error.errors.present?
|
41
|
+
format_arr(validated_request.error.errors.map(&:error))
|
42
|
+
else
|
43
|
+
format_str(validated_request.error.message)
|
44
|
+
end
|
27
45
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# @response_validator.validate(request, response)
|
32
|
-
rescue OpenapiFirst::NotFoundError
|
33
|
-
PlugApp::Middleware::NotFound.new.call(env)
|
34
|
-
rescue OpenapiFirst::RequestInvalidError => e
|
35
|
-
error_hsh = ::ErrorSerializer.format(e.message)
|
36
|
-
Rails.logger.error(error_hsh) if print_user_api_errors?
|
37
|
-
return [PlugApp::HTTP::BAD_REQUEST_I, { "Content-Type" => "application/json" }, [error_hsh]]
|
38
|
-
rescue StandardError => e
|
39
|
-
raise e unless Rails.env.production?
|
40
|
-
|
41
|
-
logger.error(
|
42
|
-
"openapi.request_validation.error",
|
43
|
-
path: request.path,
|
44
|
-
method: request.env["REQUEST_METHOD"],
|
45
|
-
error_message: e.message,
|
46
|
-
)
|
46
|
+
Rails.logger.error(error_message) if print_user_api_errors?
|
47
|
+
[PlugApp::HTTP::BAD_REQUEST_I, { "Content-Type" => "application/json" }, [error_message]]
|
48
|
+
end
|
47
49
|
end
|
50
|
+
rescue StandardError => e
|
51
|
+
raise e unless Rails.env.production?
|
52
|
+
|
53
|
+
logger.error(
|
54
|
+
"openapi.request_validation.error",
|
55
|
+
path: request.path,
|
56
|
+
method: request.env["REQUEST_METHOD"],
|
57
|
+
error_message: e.message,
|
58
|
+
)
|
48
59
|
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private def format_str(error)
|
63
|
+
{
|
64
|
+
errors: [
|
65
|
+
{
|
66
|
+
message: error,
|
67
|
+
},
|
68
|
+
],
|
69
|
+
}.to_json
|
70
|
+
end
|
49
71
|
|
50
|
-
|
72
|
+
private def format_arr(errors)
|
73
|
+
{
|
74
|
+
errors: errors.each_with_object([]) do |error, arr|
|
75
|
+
arr << {
|
76
|
+
message: error,
|
77
|
+
}
|
78
|
+
end,
|
79
|
+
}.to_json
|
51
80
|
end
|
52
81
|
end
|
53
82
|
end
|
data/templates/compose.yml
CHANGED
@@ -2,98 +2,77 @@
|
|
2
2
|
"CreateAppMessage": {
|
3
3
|
"type": "object",
|
4
4
|
"required": [
|
5
|
-
"
|
6
|
-
"message",
|
7
|
-
"inbox"
|
5
|
+
"yetto"
|
8
6
|
],
|
9
7
|
"properties": {
|
10
|
-
"
|
8
|
+
"yetto": {
|
11
9
|
"type": "object",
|
12
10
|
"required": [
|
13
|
-
"
|
14
|
-
"
|
11
|
+
"plug_installation",
|
12
|
+
"message"
|
15
13
|
],
|
16
14
|
"properties": {
|
17
|
-
"
|
18
|
-
"type": "string",
|
19
|
-
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
20
|
-
},
|
21
|
-
"settings": {
|
22
|
-
"type": "object",
|
23
|
-
"required": [],
|
24
|
-
"properties": {}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"inbox": {
|
29
|
-
"type": "object",
|
30
|
-
"required": [
|
31
|
-
"id",
|
32
|
-
"organization"
|
33
|
-
],
|
34
|
-
"properties": {
|
35
|
-
"id": {
|
36
|
-
"type": "string",
|
37
|
-
"pattern": "^(?:ibx)_[A-Z0-9]{26}$"
|
38
|
-
},
|
39
|
-
"organization": {
|
15
|
+
"plug_installation": {
|
40
16
|
"type": "object",
|
41
17
|
"required": [
|
42
18
|
"id",
|
43
|
-
"
|
19
|
+
"settings"
|
44
20
|
],
|
45
21
|
"properties": {
|
46
22
|
"id": {
|
47
23
|
"type": "string",
|
48
|
-
"pattern": "^(?:
|
24
|
+
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
49
25
|
},
|
50
|
-
"
|
51
|
-
"type": "
|
26
|
+
"settings": {
|
27
|
+
"type": "object",
|
28
|
+
"required": [],
|
29
|
+
"properties": {}
|
52
30
|
}
|
53
31
|
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
},
|
57
|
-
"message": {
|
58
|
-
"type": "object",
|
59
|
-
"required": [
|
60
|
-
"id",
|
61
|
-
"conversation",
|
62
|
-
"text_content",
|
63
|
-
"metadata"
|
64
|
-
],
|
65
|
-
"properties": {
|
66
|
-
"id": {
|
67
|
-
"type": "string",
|
68
|
-
"pattern": "^(?:msg)_[A-Z0-9]{26}$"
|
69
|
-
},
|
70
|
-
"text_content": {
|
71
|
-
"type": "string"
|
72
|
-
},
|
73
|
-
"metadata": {
|
74
|
-
"type": "object"
|
75
32
|
},
|
76
|
-
"
|
33
|
+
"message": {
|
77
34
|
"type": "object",
|
78
35
|
"required": [
|
79
36
|
"id",
|
80
|
-
"
|
37
|
+
"conversation",
|
38
|
+
"text_content",
|
81
39
|
"metadata"
|
82
40
|
],
|
83
41
|
"properties": {
|
84
42
|
"id": {
|
85
43
|
"type": "string",
|
86
|
-
"pattern": "^(?:
|
44
|
+
"pattern": "^(?:msg)_[A-Z0-9]{26}$"
|
87
45
|
},
|
88
|
-
"
|
46
|
+
"text_content": {
|
89
47
|
"type": "string"
|
90
48
|
},
|
91
49
|
"metadata": {
|
92
50
|
"type": "object"
|
51
|
+
},
|
52
|
+
"conversation": {
|
53
|
+
"type": "object",
|
54
|
+
"required": [
|
55
|
+
"id",
|
56
|
+
"title",
|
57
|
+
"metadata"
|
58
|
+
],
|
59
|
+
"properties": {
|
60
|
+
"id": {
|
61
|
+
"type": "string",
|
62
|
+
"pattern": "^(?:cnv)_[A-Z0-9]{26}$"
|
63
|
+
},
|
64
|
+
"title": {
|
65
|
+
"type": "string"
|
66
|
+
},
|
67
|
+
"metadata": {
|
68
|
+
"type": "object"
|
69
|
+
}
|
70
|
+
}
|
93
71
|
}
|
94
72
|
}
|
95
73
|
}
|
96
|
-
}
|
74
|
+
},
|
75
|
+
"additionalProperties": false
|
97
76
|
}
|
98
77
|
},
|
99
78
|
"additionalProperties": false
|
@@ -101,65 +80,35 @@
|
|
101
80
|
"ConfigureApp": {
|
102
81
|
"type": "object",
|
103
82
|
"required": [
|
104
|
-
"
|
105
|
-
"organization",
|
106
|
-
"plug",
|
107
|
-
"inbox"
|
83
|
+
"yetto"
|
108
84
|
],
|
109
85
|
"properties": {
|
110
|
-
"
|
86
|
+
"yetto": {
|
111
87
|
"type": "object",
|
112
88
|
"required": [
|
113
|
-
"
|
114
|
-
"settings"
|
89
|
+
"plug_installation",
|
115
90
|
],
|
116
91
|
"properties": {
|
117
|
-
"
|
118
|
-
"type": "string",
|
119
|
-
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
120
|
-
},
|
121
|
-
"settings": {
|
92
|
+
"plug_installation": {
|
122
93
|
"type": "object",
|
123
|
-
"required": [
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
}
|
139
|
-
},
|
140
|
-
"plug": {
|
141
|
-
"type": "object",
|
142
|
-
"required": [
|
143
|
-
"id"
|
144
|
-
],
|
145
|
-
"properties": {
|
146
|
-
"id": {
|
147
|
-
"type": "string",
|
148
|
-
"pattern": "^(?:plg)_[A-Z0-9]{26}$"
|
149
|
-
}
|
150
|
-
}
|
151
|
-
},
|
152
|
-
"inbox": {
|
153
|
-
"type": "object",
|
154
|
-
"required": [
|
155
|
-
"id"
|
156
|
-
],
|
157
|
-
"properties": {
|
158
|
-
"id": {
|
159
|
-
"type": "string",
|
160
|
-
"pattern": "^(?:ibx)_[A-Z0-9]{26}$"
|
94
|
+
"required": [
|
95
|
+
"id",
|
96
|
+
"settings"
|
97
|
+
],
|
98
|
+
"properties": {
|
99
|
+
"id": {
|
100
|
+
"type": "string",
|
101
|
+
"pattern": "^(?:pli)_[A-Z0-9]{26}$"
|
102
|
+
},
|
103
|
+
"settings": {
|
104
|
+
"type": "object",
|
105
|
+
"required": [],
|
106
|
+
"properties": {}
|
107
|
+
}
|
108
|
+
}
|
161
109
|
}
|
162
|
-
}
|
110
|
+
},
|
111
|
+
"additionalProperties": false
|
163
112
|
}
|
164
113
|
},
|
165
114
|
"additionalProperties": false
|
@@ -13,6 +13,18 @@ LD_PRELOAD_PATH = "/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
|
|
13
13
|
web = "./bin/rails server"
|
14
14
|
worker = "bundle exec sidekiq"
|
15
15
|
|
16
|
+
[[vm]]
|
17
|
+
cpu_kind = "performance"
|
18
|
+
cpus = 2
|
19
|
+
memory = "4gb"
|
20
|
+
processes = ["web"]
|
21
|
+
|
22
|
+
[[vm]]
|
23
|
+
cpu_kind = "performance"
|
24
|
+
cpus = 1
|
25
|
+
memory = "2gb"
|
26
|
+
processes = ["worker"]
|
27
|
+
|
16
28
|
[http_service]
|
17
29
|
internal_port = 3000
|
18
30
|
force_https = true
|
@@ -9,6 +9,18 @@ LD_PRELOAD_PATH = "/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
|
|
9
9
|
web = "./bin/rails server"
|
10
10
|
worker = "bundle exec sidekiq"
|
11
11
|
|
12
|
+
[[vm]]
|
13
|
+
cpu_kind = "shared"
|
14
|
+
cpus = 2
|
15
|
+
memory = "2gb"
|
16
|
+
processes = ["web"]
|
17
|
+
|
18
|
+
[[vm]]
|
19
|
+
cpu_kind = "shared"
|
20
|
+
cpus = 2
|
21
|
+
memory = "1gb"
|
22
|
+
processes = ["worker"]
|
23
|
+
|
12
24
|
[http_service]
|
13
25
|
internal_port = 3000
|
14
26
|
force_https = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hephaestus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
force_ruby_platform: false
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: rails
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +52,6 @@ dependencies:
|
|
53
52
|
- - "~>"
|
54
53
|
- !ruby/object:Gem::Version
|
55
54
|
version: '7.0'
|
56
|
-
force_ruby_platform: false
|
57
55
|
- !ruby/object:Gem::Dependency
|
58
56
|
name: rainbow
|
59
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,7 +66,6 @@ dependencies:
|
|
68
66
|
- - "~>"
|
69
67
|
- !ruby/object:Gem::Version
|
70
68
|
version: '3.0'
|
71
|
-
force_ruby_platform: false
|
72
69
|
- !ruby/object:Gem::Dependency
|
73
70
|
name: minitest
|
74
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,7 +97,7 @@ dependencies:
|
|
100
97
|
description: 'Hephaestus is a Rails generator to create plugs for Yetto.
|
101
98
|
|
102
99
|
'
|
103
|
-
email:
|
100
|
+
email:
|
104
101
|
executables:
|
105
102
|
- hephaestus
|
106
103
|
extensions: []
|
@@ -130,6 +127,7 @@ files:
|
|
130
127
|
- lib/hephaestus/version.rb
|
131
128
|
- templates/.dockerignore
|
132
129
|
- templates/.env.sample
|
130
|
+
- templates/.github/.DS_Store
|
133
131
|
- templates/.github/dependabot.yml
|
134
132
|
- templates/.github/workflows/automerge.yml
|
135
133
|
- templates/.github/workflows/deploy.yml
|
@@ -168,7 +166,6 @@ files:
|
|
168
166
|
- templates/app/lib/path_parameter/yetto_parameters.rb
|
169
167
|
- templates/app/lib/plug_app/http.rb
|
170
168
|
- templates/app/lib/plug_app/middleware/malformed_request.rb
|
171
|
-
- templates/app/lib/plug_app/middleware/not_found.rb
|
172
169
|
- templates/app/lib/plug_app/middleware/openapi_validation.rb
|
173
170
|
- templates/app/lib/plug_app/middleware/tracing_attributes.rb
|
174
171
|
- templates/app/lib/query_parameter.rb
|
@@ -234,7 +231,7 @@ homepage: http://github.com/yettoapp/hephaestus
|
|
234
231
|
licenses:
|
235
232
|
- MIT
|
236
233
|
metadata: {}
|
237
|
-
post_install_message:
|
234
|
+
post_install_message:
|
238
235
|
rdoc_options:
|
239
236
|
- "--charset=UTF-8"
|
240
237
|
require_paths:
|
@@ -243,15 +240,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
240
|
requirements:
|
244
241
|
- - ">="
|
245
242
|
- !ruby/object:Gem::Version
|
246
|
-
version: 3.
|
243
|
+
version: 3.3.0
|
247
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
245
|
requirements:
|
249
246
|
- - ">="
|
250
247
|
- !ruby/object:Gem::Version
|
251
248
|
version: 3.4.7
|
252
249
|
requirements: []
|
253
|
-
rubygems_version: 3.5.
|
254
|
-
signing_key:
|
250
|
+
rubygems_version: 3.5.9
|
251
|
+
signing_key:
|
255
252
|
specification_version: 4
|
256
253
|
summary: Generate a Rails app that can be used to create plugs for Yetto.
|
257
254
|
test_files: []
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "openapi_first"
|
5
|
-
|
6
|
-
module PlugApp
|
7
|
-
module Middleware
|
8
|
-
# frozen_string_literal: true
|
9
|
-
|
10
|
-
# Rack::NotFound is a default endpoint. Optionally initialize with the
|
11
|
-
# path to a custom 404 page, to override the standard response body.
|
12
|
-
#
|
13
|
-
# Examples:
|
14
|
-
#
|
15
|
-
# Serve default 404 response:
|
16
|
-
# run Rack::NotFound.new
|
17
|
-
#
|
18
|
-
# Serve a custom 404 page:
|
19
|
-
# run Rack::NotFound.new('path/to/your/404.html')
|
20
|
-
|
21
|
-
class NotFound
|
22
|
-
F = ::File
|
23
|
-
|
24
|
-
def initialize(path = nil, content_type = "text/html")
|
25
|
-
if path.nil?
|
26
|
-
@content = "Not found\n"
|
27
|
-
else
|
28
|
-
@content = F.read(path)
|
29
|
-
@content = F.read(path)
|
30
|
-
end
|
31
|
-
@length = @content.bytesize.to_s
|
32
|
-
|
33
|
-
@content_type = content_type
|
34
|
-
end
|
35
|
-
|
36
|
-
def call(env)
|
37
|
-
[404, { "Content-Type" => @content_type, "Content-Length" => @length }, [@content]]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|