forked from remp2020/remp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.neon
262 lines (232 loc) · 12.8 KB
/
config.neon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
parameters:
locale: @environmentConfig::get('LOCALE')
timezone: @environmentConfig::get('TIMEZONE')
sso_addr: @environmentConfig::get('SSO_ADDR')
sso_error_url: @environmentConfig::get('SSO_ERROR_URL')
redis:
host: @environmentConfig::get('REDIS_HOST')
port: @environmentConfig::get('REDIS_PORT')
db: @environmentConfig::get('REDIS_DB')
hermes:
restart_file_path: @environmentConfig::get('HERMES_RESTART_FILE_PATH')
remp:
beam:
web_addr: @environmentConfig::get('REMP_BEAM_ADDR')
token: @environmentConfig::get('REMP_BEAM_API_TOKEN')
tracker_addr: @environmentConfig::get('REMP_BEAM_TRACKER_ADDR')
tracker_property_token: @environmentConfig::get('REMP_BEAM_TRACKER_PROPERTY_TOKEN')
segments_addr: @environmentConfig::get('REMP_BEAM_SEGMENTS_ADDR')
pythia:
segments_addr: @environmentConfig::get('REMP_PYTHIA_SEGMENTS_ADDR')
campaign:
web_addr: @environmentConfig::get('REMP_CAMPAIGN_ADDR')
errbit:
send_errors: false
extensions:
local_configs: Remp\MailerModule\Config\ConfigExtension
webpack: Oops\WebpackNetteAdapter\DI\WebpackExtension(true)
webpack:
devServer:
enabled: false
build:
directory: %wwwDir%/assets/vendor
publicPath: assets/vendor/
manifest:
name: mix-manifest.json
application:
errorPresenter: Mailer:Error
mapping:
Api: Tomaj\NetteApi\Presenters\*Presenter
*: Remp\*Module\Presenters\*Presenter
session:
expiration: 14 days
autoStart: true
database:
default:
dsn: @environmentConfig::getDsn()
user: @environmentConfig::get('DB_USER')
password: @environmentConfig::get('DB_PASS')
options:
lazy: yes
services:
router: Remp\RouterFactory::createRouter
environmentConfig:
class: Remp\MailerModule\EnvironmentConfig
setup:
- linkService(beam, %remp.beam.web_addr%, album)
- linkService(campaign, %remp.campaign.web_addr%, trending-up)
- linkService(mailer, /, email)
- setParam(locale, %locale%)
# Latte filters
filterLoader:
class: Remp\MailerModule\Filters\FilterLoader
setup:
- register('yesNo', [Remp\MailerModule\Filters\YesNoFilter(), process])
nette.latteFactory:
setup:
- addFilter(null, [@filterLoader, 'load'])
console:
class: Remp\MailerModule\Console\Application
setup:
- register(Remp\MailerModule\Commands\ProcessJobCommand())
- register(Remp\MailerModule\Commands\MailWorkerCommand(@commandsLogger))
- register(Remp\MailerModule\Commands\DatabaseSeedCommand())
- register(Remp\MailerModule\Commands\DemoSeedCommand())
- register(Remp\MailerModule\Commands\ProcessJobStatsCommand())
- register(Remp\MailerModule\Commands\AggregateMailTemplateStatsCommand())
- register(Remp\MailerModule\Commands\HeartbeatCommand())
- register(Remp\MailerModule\Commands\MailTypeStatsCommand())
- register(@hermesWorker)
- setCatchExceptions(true)
# Loggers
commandsLogger:
class: Monolog\Logger('commands-logger')
mailProcessLogger:
class: Monolog\Logger('mail-process-logger')
hermesLogger:
class: Monolog\Logger('hermes-logger')
dateFormatterFactory:
class: Remp\MailerModule\Formatters\DateFormatterFactory(%locale%, %timezone%)
hermesRestart: Tomaj\Hermes\Restart\SharedFileRestart(%hermes.restart_file_path%)
hermesDispatcher:
class: Tomaj\Hermes\Dispatcher(Remp\MailerModule\Hermes\RedisDriver(), @hermesLogger, @hermesRestart)
hermesEmitter:
class: Tomaj\Hermes\Emitter(Remp\MailerModule\Hermes\RedisDriver(), @hermesLogger)
- Remp\MailerModule\Hermes\HermesTasksQueue(%redis.host%, %redis.port%, %redis.db%)
- Remp\MailerModule\Repository\HermesTasksRepository
redisCache: Remp\MailerModule\RedisCache(%redis.host%, %redis.port%, %redis.db%)
hermesWorker:
class: Remp\MailerModule\Commands\HermesWorkerCommand
setup:
- add('list-created', Remp\MailerModule\Hermes\ListCreatedHandler())
- add('mailgun-event', Remp\MailerModule\Hermes\MailgunEventHandler())
- add('heartbeat', Remp\MailerModule\Hermes\PingMysql())
# - add('mail-sent', Remp\MailerModule\Hermes\MailSentHandler())
eventEmitter:
class: League\Event\Emitter
segmentAgreggator:
class: Remp\MailerModule\Segment\Aggregator
mailFactory:
class: Remp\MailerModule\Sender\MailerFactory
setup:
# Register all Mailers (Nette\Mail\IMailer)
- addMailer(Remp\MailerModule\Mailer\SmtpMailer())
- addMailer(Remp\MailerModule\Mailer\MailgunMailer())
# # Internal CRM system. For more details contact Tomas Bella.
# authenticator:
# class: Remp\MailerModule\Auth\Authenticator
# authStorage:
# class: Remp\MailerModule\Auth\RemoteUser(%sso_host%)
# SSO authentication
- Remp\NetteSso\Security\Client(%sso_addr%)
authenticator:
class: Remp\NetteSso\Security\Authenticator(%sso_error_url%)
security.userStorage:
class: Remp\NetteSso\Security\UserStorage
# API authentication
apiTokenRepository:
class: Remp\MailerModule\Auth\SsoTokenRepository
# Beam
- Remp\MailerModule\Beam\Client(%remp.beam.web_addr%, %remp.beam.token%)
- Remp\MailerModule\Generators\Dynamic\UnreadArticlesGenerator
- Remp\MailerModule\Beam\JournalFactory(%remp.beam.segments_addr%)
- Remp\MailerModule\Config\Config
- Remp\MailerModule\Sender
- Remp\MailerModule\Job\BatchEmailGenerator(@mailProcessLogger)
- Remp\MailerModule\Job\MailCache(%redis.host%, %redis.port%, %redis.db%)
- Remp\MailerModule\Auth\AutoLogin
# API
- Tomaj\NetteApi\Link\ApiLink
- Tomaj\NetteApi\Misc\IpDetector
apiDecider:
class: Tomaj\NetteApi\ApiDecider
setup:
- enableGlobalPreflight()
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'subscribe'), \Remp\MailerModule\Api\v1\Handlers\Users\SubscribeHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'un-subscribe'), \Remp\MailerModule\Api\v1\Handlers\Users\UnSubscribeHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'bulk-subscribe'), \Remp\MailerModule\Api\v1\Handlers\Users\BulkSubscribeHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'check-token'), \Remp\MailerModule\Api\v1\Handlers\Users\CheckTokenHandler(), \Tomaj\NetteApi\Authorization\NoAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'email-changed'), \Remp\MailerModule\Api\v1\Handlers\Users\EmailChangedHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'user-registered'), \Remp\MailerModule\Api\v1\Handlers\Users\UserRegisteredHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'users', 'bulk-user-registered'), \Remp\MailerModule\Api\v1\Handlers\Users\BulkUserRegisteredHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'mailers', 'mailgun'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailgunEventsHandler(), \Tomaj\NetteApi\Authorization\NoAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'mailers', 'generate-mail'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailGeneratorHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'mailers', 'preprocess-generator-parameters'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailGeneratorPreprocessHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('GET', 1, 'mailers', 'generator-templates'), \Remp\MailerModule\Api\v1\Handlers\Mailers\GeneratorTemplatesListingHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'mailers', 'templates'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailCreateTemplateHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'mailers', 'jobs'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailJobCreateApiHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('GET', 1, 'mailers', 'mail-types'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailTypesListingHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 1, 'mailers', 'mail-type-upsert'), \Remp\MailerModule\Api\v1\Handlers\Mailers\MailTypeUpsertHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('GET', 1, 'segments', 'list'), \Remp\MailerModule\Api\v1\Handlers\Segments\SegmentsListingHandler(), \Tomaj\NetteApi\Authorization\BearerTokenAuthorization())
- addApiHandler(\Tomaj\NetteApi\EndpointIdentifier('POST', 2, 'mailers', 'mailgun'), \Remp\MailerModule\Api\v2\Handlers\Mailers\MailgunEventsHandler(), \Tomaj\NetteApi\Authorization\NoAuthorization())
# Generator
generator:
class: Remp\MailerModule\Generators\GeneratorFactory
setup:
- registerGenerator('empty', 'Empty generator', Remp\MailerModule\Generators\EmptyGenerator())
- registerGenerator('best_performing_articles', 'Best performing articles', \Remp\MailerModule\Generators\GenericBestPerformingArticlesGenerator())
transporter:
class: Remp\MailerModule\PageMeta\GuzzleTransport
content:
class: Remp\MailerModule\PageMeta\GenericPageContent
# Repositories
- Remp\MailerModule\Repository\AuditLogRepository
- Remp\MailerModule\Repository\ConfigsRepository
- Remp\MailerModule\Repository\UsersRepository
- Remp\MailerModule\Repository\UserSubscriptionsRepository
- Remp\MailerModule\Repository\UserSubscriptionVariantsRepository
- Remp\MailerModule\Repository\LogsRepository
- Remp\MailerModule\Repository\LogConversionsRepository
- Remp\MailerModule\Repository\LayoutsRepository
- Remp\MailerModule\Repository\ListsRepository
- Remp\MailerModule\Repository\ListCategoriesRepository
- Remp\MailerModule\Repository\ListVariantsRepository
- Remp\MailerModule\Repository\TemplatesRepository
- Remp\MailerModule\Repository\JobsRepository
- Remp\MailerModule\Repository\JobQueueRepository
- Remp\MailerModule\Repository\BatchesRepository
- Remp\MailerModule\Repository\BatchTemplatesRepository
- Remp\MailerModule\Repository\AutoLoginTokensRepository
- Remp\MailerModule\Repository\SourceTemplatesRepository
- Remp\MailerModule\Repository\MailTypesRepository
- Remp\MailerModule\Repository\MailTemplateStatsRepository
- Remp\MailerModule\Repository\MailTypeStatsRepository
# Factories
- Remp\MailerModule\Components\IDataTableFactory
- Remp\MailerModule\Components\ISendingStatsFactory
- Remp\MailerModule\Components\IMissingConfigurationFactory
- Remp\MailerModule\Components\IGeneratorWidgetsFactory
- Remp\MailerModule\Components\IBatchExperimentEvaluationFactory
# Generator Widgets
- Remp\MailerModule\Components\GeneratorWidgetsManager
- Remp\MailerModule\Components\GeneratorWidgets\Widgets\NewsfilterWidget
- Remp\MailerModule\Components\GeneratorWidgets\Widgets\NovydenikNewsfilterWidget
- Remp\MailerModule\Components\GeneratorWidgets\Widgets\MediaBriefingWidget
- Remp\MailerModule\Components\GeneratorWidgets\Widgets\DennikeWidget
- Remp\MailerModule\Components\GeneratorWidgets\Widgets\TldrWidget
- Remp\MailerModule\Components\GeneratorWidgets\Widgets\MMSWidget
# Forms
- Remp\MailerModule\Forms\SignInFormFactory
- Remp\MailerModule\Forms\ConfigFormFactory
- Remp\MailerModule\Forms\ListFormFactory
- Remp\MailerModule\Forms\LayoutFormFactory
- Remp\MailerModule\Forms\TemplateFormFactory
- Remp\MailerModule\Forms\TemplateTestFormFactory
- Remp\MailerModule\Forms\JobFormFactory
- Remp\MailerModule\Forms\NewBatchFormFactory
- Remp\MailerModule\Forms\EditBatchFormFactory
- Remp\MailerModule\Forms\NewTemplateFormFactory
- Remp\MailerModule\Forms\SourceTemplateFormFactory
- Remp\MailerModule\Forms\MailGeneratorFormFactory
- Remp\MailerModule\Forms\NovydenikNewsfilterTemplateFormFactory('users_with_any_subscriptions', 'users-without-subscription')
- Remp\MailerModule\Forms\NewsfilterTemplateFormFactory('users_with_active_subscriptions', 'users_without_actual_subscriptions')
- Remp\MailerModule\Forms\MediaBriefingTemplateFormFactory('users_with_active_subscriptions', 'users_without_actual_subscriptions')
- Remp\MailerModule\Forms\DennikeTemplateFormFactory('users_with_active_subscriptions', 'users_without_actual_subscriptions')
- Remp\MailerModule\Forms\TldrTemplateFormFactory('users_with_active_subscriptions', 'users_without_actual_subscriptions')
- Remp\MailerModule\Forms\MMSTemplateFormFactory('users_with_active_subscriptions', 'users_without_actual_subscriptions')
# Helpers
- Remp\MailerModule\Generators\WordpressHelpers
embedParser:
class: Remp\MailerModule\Generators\EmbedParser
articleLocker:
class: Remp\MailerModule\Generators\ArticleLocker