Skip to content

Commit e282053

Browse files
committed
Fix nest libertech template
1 parent 87219ea commit e282053

File tree

75 files changed

+5016
-2492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+5016
-2492
lines changed

.env.example

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
APPNAME=template
1+
APPNAME=mailrest
22

3-
MONGOOSE_URL=mongodb://template-mongodb:27017/myreport
43
IOREDIS_URL=redis://template-redis:6379/1
54

65
JWT_SECRET=1212974
76
CRYPT_SECURITYKEY=78987946
87

9-
PASSPORT_LDAP_URL=ldap://template-openldap:389
10-
PASSPORT_LDAP_BINDDN=cn=admin,dc=test,dc=local
11-
PASSPORT_LDAP_BINDCREDENTIALS=
12-
PASSPORT_LDAP_SEARCHBASE=dc=test,dc=local
13-
LDAP_LOG_LEVEL=trace
14-
158
MAILER_TRANSPORT_HOST=template-maildev
169
MAILER_TRANSPORT_PORT=1025
1710
MAILER_TRANSPORT_SECURE=0
1811
MAILER_TRANSPORT_IGNORETLS=0
1912
MAILER_TRANSPORT_AUTHUSER=''
2013
MAILER_TRANSPORT_AUTHPASS=''
21-
MAILER_DEFAULTS_FROM="'test' <test@test.com>"
14+
MAILER_DEFAULTS_FROM="'test' <test@test.com>"
15+
# https://ethereal.email/
16+
# https://webhook.site/

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ module.exports = {
2424
'@typescript-eslint/no-explicit-any': 'off',
2525
'@typescript-eslint/no-var-requires': 'off',
2626
},
27-
};
27+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
documentation/
23
dist/
34
.DS_Store/
45
.idea/

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"singleQuote": true,
55
"trailingComma": "all",
66
"arrowParens": "always",
7-
"printWidth": 120,
7+
"printWidth": 150,
88
"bracketSpacing": true
99
}

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased] - 2023-08-03
9+
10+
Generating a basic project structure
11+
12+
### Added
13+
- [MAILREST#1](https://github.com/Libertech-FR/mailrest/issues/1)
14+
Define base structure.
15+
- [MAILREST#2](https://github.com/Libertech-FR/mailrest/issues/2)
16+
Create basic documentation.
17+
- [MAILREST#3](https://github.com/Libertech-FR/mailrest/issues/3)
18+
Implements github workflows.
19+
<!-- ### Changed -->
20+
<!-- ### Fixed -->

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ RUN yarn install \
3939

4040
COPY --from=builder /usr/src/app/dist ./dist
4141

42-
EXPOSE 4000
42+
EXPOSE 7000
4343

4444
CMD ["yarn", "start:prod"]

Makefile

Lines changed: 5 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
IMGNAME?=exemple
2-
APPNAME?=exemple
3-
APPPORT?=4500
4-
5-
LDAPORGANISATION?=exemple
6-
LDAPDOMAIN?=exemple.local
7-
LDAPPASSWORD?=
8-
OPENLDAP_PORT?=389
9-
10-
MAILDEVPORTWEB?=1080
11-
MAILDEVPORTMAIL?=1025
1+
IMGNAME?=ghcr.io/libertech-fr/mailrest
2+
APPNAME?=mailrest
3+
APPPORT?=7000
124

135
init:
146
@docker build -t $(IMGNAME) .
157
@docker exec -it $(APPNAME) yarn install
16-
8+
179
build:
1810
docker build -t $(IMGNAME) .
1911

@@ -30,7 +22,7 @@ dev:
3022
--add-host host.docker.internal:host-gateway \
3123
--name $(APPNAME) \
3224
--network dev \
33-
-p $(APPPORT):4000 \
25+
-p $(APPPORT):7000 \
3426
-v $(CURDIR):/usr/src/app \
3527
$(IMGNAME) yarn start:dev
3628

@@ -46,64 +38,16 @@ generate:
4638
@docker exec -it $(APPNAME) yarn generate
4739

4840
dbs:
49-
@docker run --rm -d \
50-
--name $(APPNAME)-openldap \
51-
-e LDAP_ORGANISATION=$(LDAPORGANISATION) \
52-
-e LDAP_DOMAIN=$(LDAPDOMAIN) \
53-
-e LDAP_ADMIN_PASSWORD=$(LDAPPASSWORD) \
54-
--network dev \
55-
-v $(CURDIR)/openldap/custom:/container/service/slapd/assets/config/bootstrap/ldif/custom \
56-
-p $(OPENLDAP_PORT):389 \
57-
osixia/openldap:1.5.0 --loglevel debug --copy-service
58-
5941
@docker volume create $(APPNAME)-redis
6042
@docker run -d --rm \
6143
--name $(APPNAME)-redis \
6244
--network dev \
6345
-p 6379:6379 \
6446
redis
65-
@docker volume create $(APPNAME)-mongodb
66-
@docker run -d --rm \
67-
--name $(APPNAME)-mongodb \
68-
-v $(APPNAME)-mongodb:/data/db \
69-
-p 27017:27017 \
70-
--network dev \
71-
mongo:5.0 --wiredTigerCacheSizeGB 1.5 --quiet || true
72-
73-
@docker run --rm -d \
74-
--name $(APPNAME)-ldapadmin \
75-
-e PHPLDAPADMIN_LDAP_HOSTS=ga.service.usermanager.openldap \
76-
-e PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'$(APPNAME)-openldap': [{'login': [{'bind_id': 'cn=admin,dc=test,dc=local'}]}]}]" \
77-
-v $(CURDIR)/phpldapadmin/exemples/:/data/exemples \
78-
-p 6443:443 \
79-
--network dev \
80-
osixia/phpldapadmin || true
81-
82-
@docker run --rm -d --name $(APPNAME)-maildev \
83-
-p $(MAILDEVPORTWEB):1080 \
84-
-p $(MAILDEVPORTMAIL):1025 \
85-
--network dev \
86-
maildev/maildev || true
8747

8848
stop:
89-
@docker stop $(APPNAME)-maildev || true
90-
@docker stop $(APPNAME)-ldapadmin || true
91-
@docker stop $(APPNAME)-mongodb || true
9249
@docker stop $(APPNAME)-redis || true
93-
@docker stop $(APPNAME)-openldap || true
9450
@docker stop $(APPNAME) || true
9551

9652
rm:
9753
docker rm $(shell docker ps -a -q -f name=$(APPNAME))
98-
99-
100-
openldap:
101-
docker run --rm -it \
102-
--name $(APPNAME)-openldap \
103-
-e LDAP_ORGANISATION=$(LDAPORGANISATION) \
104-
-e LDAP_DOMAIN=$(LDAPDOMAIN) \
105-
-e LDAP_ADMIN_PASSWORD=$(LDAPPASSWORD) \
106-
--network dev \
107-
-v $(CURDIR)/openldap/custom:/container/service/slapd/assets/config/bootstrap/ldif/custom \
108-
-p $(OPENLDAP_PORT):389 \
109-
osixia/openldap:1.5.0 --loglevel trace --copy-service

config/accounts.sample.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '1'
2+
3+
mailboxes:
4+
- id: 'my.mailbox'
5+
name: 'Mailbox 1'
6+
imap:
7+
host: 'imap.gmail.com'
8+
port: 993
9+
tls: true
10+
username: ''
11+
password: ''
12+
smtp:
13+
host: 'smtp.gmail.com'
14+
port: 465
15+
tls: true
16+
username: ''
17+
password: ''

config/tokens.sample.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: '1'
2+
3+
tokens:
4+
- key: 2135646
5+
ip: ['127.0.0.1']

jest.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
moduleFileExtensions: ['js', 'json', 'ts'],
3+
rootDir: '.',
4+
testEnvironment: 'node',
5+
testMatch: ['<rootDir>/src/**/*spec.ts'],
6+
transform: {
7+
'^.+\\.(t|j)s$': [
8+
'ts-jest',
9+
{
10+
tsconfig: '<rootDir>/tsconfig.json',
11+
ignoreCodes: ['TS151001'],
12+
},
13+
],
14+
},
15+
collectCoverage: true,
16+
}

0 commit comments

Comments
 (0)