Class: GDK::Services::Base Abstract
- Inherits:
-
Object
- Object
- GDK::Services::Base
- Defined in:
- lib/gdk/services/base.rb
Overview
This class is abstract.
Base class to be used by individual service classes.
Direct Known Subclasses
Clickhouse, GitlabAiGateway, GitlabHttpRouter, GitlabTopologyService, Minio, OpenBao, OpenLDAP, PostgresqlReplica, RailsWeb, Required, Vault
Instance Method Summary collapse
-
#command ⇒ String
abstract
Command to execute the service.
-
#enabled? ⇒ Boolean
Is service enabled?.
-
#env ⇒ Hash
Environment variables.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#name ⇒ String
abstract
Name of the service.
-
#procfile_entry ⇒ String
Entry to be used in Procfile.
-
#ready_message ⇒ String
abstract
Message to display when the service is ready.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
10 11 12 |
# File 'lib/gdk/services/base.rb', line 10 def initialize validate_env_keys! end |
Instance Method Details
#command ⇒ String
This method is abstract.
to be implemented by the subclass
Command to execute the service
26 27 28 |
# File 'lib/gdk/services/base.rb', line 26 def command raise NotImplementedError end |
#enabled? ⇒ Boolean
Is service enabled?
41 42 43 |
# File 'lib/gdk/services/base.rb', line 41 def enabled? false end |
#env ⇒ Hash
Environment variables
this service.
49 50 51 |
# File 'lib/gdk/services/base.rb', line 49 def env {} end |
#name ⇒ String
This method is abstract.
to be implemented by the subclass
Name of the service
18 19 20 |
# File 'lib/gdk/services/base.rb', line 18 def name raise NotImplementedError end |
#procfile_entry ⇒ String
Entry to be used in Procfile.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/gdk/services/base.rb', line 56 def procfile_entry cmd = [] cmd << '#' unless enabled? cmd += %W[#{name}: exec] if env.any? cmd << '/usr/bin/env' cmd += env.map { |k, v| "#{k}=\"#{v}\"" } end cmd << command cmd.join(' ') end |
#ready_message ⇒ String
This method is abstract.
to be implemented by the subclass
Message to display when the service is ready
34 35 36 |
# File 'lib/gdk/services/base.rb', line 34 def raise NotImplementedError end |