-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.env-example
142 lines (126 loc) · 3.71 KB
/
.env-example
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
POSTGRES_USER=<userrname>
POSTGRES_PASSWORD=<passwort>
POSTGRES_DB=<db-name>
TEST_DATA_USER_PASSWORD=<password>
AUTH_IS_ACTIVE=true
GRPC_COMMUNICATION=false
JWT_ACCESS_TOKEN_EXPIRATION=15m
JWT_REFRESH_TOKEN_EXPIRATION=168h
# The following is used for docker-compose-loadbalance.yaml
CONFIG_FILE="
mappings:
- path: /api/v1/login
hosts:
- http://user:8080
- path: /api/v1/register
hosts:
- http://user:8080
- path: /api/v1/refresh-token
hosts:
- http://user:8080
- path: /api/v1/logout
hosts:
- http://user:8080
- path: /api/v1/users*
hosts:
- http://user:8080
- path: /api/v1/books*
hosts:
- http://book:8080
- path: /api/v1/chapters*
hosts:
- http://book:8080
- path: /api/v1/transactions*
hosts:
- http://transaction:8080
- path: /api/v1/reset
hosts:
- http://test-data:8080
- path: /*
hosts:
- http://web:8080
"
JWT_ACCESS_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
<rsa-private-key-pem-format>
-----END PRIVATE KEY-----
"
JWT_ACCESS_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
<rsa-public-key-pem-format>
-----END PUBLIC KEY-----
"
JWT_REFRESH_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
<rsa-private-key-pem-format>
-----END PRIVATE KEY-----
"
JWT_REFRESH_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
<rsa-public-key-pem-format>
-----END PUBLIC KEY-----
"
TEST_DATA_FILE="
create table if not exists users
(
id serial primary key,
email varchar(100) not null unique,
password bytea not null,
profile_name varchar(100) not null,
balance int not null default 0,
token_version bigint not null default 0
);
create table if not exists books
(
id serial primary key,
name varchar(100) not null,
authorId int not null,
description text not null,
foreign key (authorId) REFERENCES users(id)
);
create table if not exists chapters
(
id int not null,
bookId int not null,
name varchar(100) not null,
price int not null,
content text not null,
status int not null default 0,
foreign key (bookId) REFERENCES books(id),
primary key (id, bookId)
);
create table if not exists transactions
(
id serial primary key,
bookid int not null,
chapterid int not null,
receivinguserid int not null,
payinguserid int not null,
amount int not null,
foreign key (chapterid, bookid) references chapters(id, bookId),
foreign key (bookid) references books (id),
foreign key (payinguserid) references users(id),
foreign key (receivinguserid) references users(id)
);
insert into users (email, password, profile_name, balance)
values ('[email protected]', $1, 'Toni Tester', 1000),
('test', $1, 'Test User', 1000);
insert into books (name, authorId, description)
values ('Book One', 1, 'A good book'),
('Book Two', 2, 'A bad book'),
('Book Three', 1, 'A mid book');
insert into chapters (id, bookId, name, price, content, status)
values (1, 1, 'The beginning', 0, 'Lorem Ipsum', 1),
(2, 1,'The beginning 2: Electric Boogaloo', 100, 'Lorem Ipsum 2', 1),
(3, 1, 'The beginning 3: My Enemy', 100, 'Lorem Ipsum 3', 1),
(1, 2, 'A different book chapter 1', 0, 'Lorem Ipsum 4', 1),
(2, 2, 'What came after', 100, 'Lorem Ipsum 5', 1),
(3, 2, 'What came after that', 500, 'Lorem Ipsum 6', 1),
(4, 2, 'And there after ', 400, 'Lorem Ipsum 7', 1),
(1, 3, 'The third book chapter 1', 750, 'Lorem Ipsum 8', 1),
(2, 3, 'The third book chapter 2', 800, 'Lorem Ipsum 9', 1),
(3, 3, 'The third book chapter 3', 900, 'Lorem Ipsum 10', 1);
insert into transactions (bookid, chapterid, receivinguserid, payinguserid, amount)
values (1, 1, 1, 2, 0),
(1, 2, 1, 2, 100),
(2, 1, 2, 1, 0),
(2, 4, 2, 1, 400),
(3, 1, 1, 2, 750),
(3, 2, 1, 2, 800);
"