souls 1.9.16 → 1.9.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/souls/app/graphql/souls_mutation.rb +61 -0
- data/lib/souls/app/index.rb +2 -0
- data/lib/souls/app/utils/firebase_id_token.rb +3 -0
- data/lib/souls/cli/docker/index.rb +8 -0
- data/lib/souls/index.rb +1 -0
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1df1462b5d987180801fe9cb33ddfc141aa90a3b0d9d6524f66eef180e1f15c
|
4
|
+
data.tar.gz: a70527d82c1c3d9df604ac1cdeeac013d888a2e99de53bca9fe822246803c28e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 978080dbe7f7c4f38410ab8fa9f31c42f5974d344d864325946e70fa53c3859575cd28655d42e08c3bbecbfd395f98925b6576240ec12b7405bb215683fda00a
|
7
|
+
data.tar.gz: 2c1a068964008ed9c0bb52cc5f902d82f77f5c908c3ea9c570bbd855a9f9f330226eec733e240f23ac370c5aadd5a334c2628fa1de44c20349b15627eaeee2b6
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ Powered by Ruby GraphQL, RBS/Steep, Active Record, RSpec, RuboCop, and Google Cl
|
|
52
52
|
|
53
53
|
![SOULs Architecture](https://souls.elsoul.nl/imgs/docs/SOULs-architecture.jpg)
|
54
54
|
|
55
|
-
SOULs creates 2 types of
|
55
|
+
SOULs creates 2 types of App.
|
56
56
|
|
57
57
|
1. API - GraphQL (Ruby) - Simple API - Cloud Run
|
58
58
|
2. Worker - Google Pub/Sub Messaging Worker API (Ruby) - Cloud Run
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Souls
|
2
|
+
class SoulsMutation < GraphQL::Schema::RelayClassicMutation
|
3
|
+
def souls_fb_auth(token:)
|
4
|
+
FirebaseIdToken::Certificates.request!
|
5
|
+
sleep(3) if ENV["RACK_ENV"] == "development"
|
6
|
+
user = FirebaseIdToken::Signature.verify(token)
|
7
|
+
raise(ArgumentError, "Invalid or Missing Token") if user.blank?
|
8
|
+
|
9
|
+
user
|
10
|
+
end
|
11
|
+
|
12
|
+
def publish_pubsub_queue(topic_name: "send-mail-job", message: "text!")
|
13
|
+
pubsub = Google::Cloud::Pubsub.new(project: ENV["SOULS_GCP_PROJECT_ID"])
|
14
|
+
topic = pubsub.topic(topic_name)
|
15
|
+
topic.publish(message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def make_graphql_query(query: "newCommentMailer", args: {})
|
19
|
+
if args.blank?
|
20
|
+
query_string = %(query { #{query.to_s.underscore.camelize(:lower)} { response } })
|
21
|
+
else
|
22
|
+
inputs = ""
|
23
|
+
args.each do |key, value|
|
24
|
+
inputs +=
|
25
|
+
if value.instance_of?(String)
|
26
|
+
"#{key.to_s.underscore.camelize(:lower)}: \"#{value}\" "
|
27
|
+
else
|
28
|
+
"#{key.to_s.underscore.camelize(:lower)}: #{value} "
|
29
|
+
end
|
30
|
+
end
|
31
|
+
query_string = %(query { #{query.to_s.underscore.camelize(:lower)}(#{inputs}) { response } })
|
32
|
+
end
|
33
|
+
query_string
|
34
|
+
end
|
35
|
+
|
36
|
+
def post_to_dev(worker_name: "", query_string: "")
|
37
|
+
app = Souls.configuration.app
|
38
|
+
port = get_worker(worker_name: "souls-#{app}-#{worker_name}")[0][:port]
|
39
|
+
endpoint = Souls.configuration.endpoint
|
40
|
+
res = Net::HTTP.post_form(URI.parse("http://localhost:#{port}#{endpoint}"), { query: query_string })
|
41
|
+
res.body
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_worker(worker_name: "")
|
45
|
+
workers = Souls.configuration.workers
|
46
|
+
workers.filter { |n| n[:name] == worker_name }
|
47
|
+
end
|
48
|
+
|
49
|
+
def auth_check(context)
|
50
|
+
raise(GraphQL::ExecutionError, "You need to sign in!!") if context[:user].nil?
|
51
|
+
end
|
52
|
+
|
53
|
+
def production?
|
54
|
+
ENV["RACK_ENV"] == "production"
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_instance_id
|
58
|
+
`curl http://metadata.google.internal/computeMetadata/v1/instance/id -H Metadata-Flavor:Google`
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/souls/app/index.rb
CHANGED
@@ -4,6 +4,7 @@ module Souls
|
|
4
4
|
def psql
|
5
5
|
system(
|
6
6
|
"docker run --rm -d \
|
7
|
+
--name souls-psql \
|
7
8
|
-p 5433:5432 \
|
8
9
|
-v postgres-tmp:/var/lib/postgresql/data \
|
9
10
|
-e POSTGRES_USER=postgres \
|
@@ -18,6 +19,7 @@ module Souls
|
|
18
19
|
def mysql
|
19
20
|
system(
|
20
21
|
"docker run --rm -d \
|
22
|
+
--name souls-mysql \
|
21
23
|
-p 3306:3306 \
|
22
24
|
-v mysql-tmp:/var/lib/mysql \
|
23
25
|
-e MYSQL_USER=mysql \
|
@@ -27,5 +29,11 @@ module Souls
|
|
27
29
|
)
|
28
30
|
system("docker ps")
|
29
31
|
end
|
32
|
+
|
33
|
+
desc "redis", "Run Redis Docker Container"
|
34
|
+
def redis
|
35
|
+
system("docker run --rm -d --name souls-redis -p 6379:6379 redis:latest")
|
36
|
+
system("docker ps")
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
data/lib/souls/index.rb
CHANGED
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.17
|
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.17
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.87.2
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: firebase_id_token
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.4.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.4.0
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: google-cloud-pubsub
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,8 +156,10 @@ files:
|
|
142
156
|
- README.md
|
143
157
|
- exe/souls
|
144
158
|
- lib/souls.rb
|
159
|
+
- lib/souls/app/graphql/souls_mutation.rb
|
145
160
|
- lib/souls/app/graphql/souls_query.rb
|
146
161
|
- lib/souls/app/index.rb
|
162
|
+
- lib/souls/app/utils/firebase_id_token.rb
|
147
163
|
- lib/souls/app/utils/souls_logger.rb
|
148
164
|
- lib/souls/cli.rb
|
149
165
|
- lib/souls/cli/cli_exception.rb
|