diff options
author | Chocobozzz <me@florianbigard.com> | 2022-12-29 14:18:07 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-04 11:41:29 +0100 |
commit | b65f5367baf799b425be0bcfb9220922751bb6eb (patch) | |
tree | 0ec740d368864ace758bb842eef6864e822c4a06 /server/initializers | |
parent | 518c5cc62d922ddedc16f5a1e2c3e7035f342115 (diff) | |
download | PeerTube-b65f5367baf799b425be0bcfb9220922751bb6eb.tar.gz PeerTube-b65f5367baf799b425be0bcfb9220922751bb6eb.tar.zst PeerTube-b65f5367baf799b425be0bcfb9220922751bb6eb.zip |
Add ability to customize token lifetime
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker-before-init.ts | 1 | ||||
-rw-r--r-- | server/initializers/config.ts | 6 | ||||
-rw-r--r-- | server/initializers/constants.ts | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index 39713a266..57852241c 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -13,6 +13,7 @@ function checkMissedConfig () { | |||
13 | 'webserver.https', 'webserver.hostname', 'webserver.port', | 13 | 'webserver.https', 'webserver.hostname', 'webserver.port', |
14 | 'secrets.peertube', | 14 | 'secrets.peertube', |
15 | 'trust_proxy', | 15 | 'trust_proxy', |
16 | 'oauth2.token_lifetime.access_token', 'oauth2.token_lifetime.refresh_token', | ||
16 | 'database.hostname', 'database.port', 'database.username', 'database.password', 'database.pool.max', | 17 | 'database.hostname', 'database.port', 'database.username', 'database.password', 'database.pool.max', |
17 | 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', | 18 | 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', |
18 | 'email.body.signature', 'email.subject.prefix', | 19 | 'email.body.signature', 'email.subject.prefix', |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index c2f8b19fd..28aaf36a9 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -149,6 +149,12 @@ const CONFIG = { | |||
149 | HOSTNAME: config.get<string>('webserver.hostname'), | 149 | HOSTNAME: config.get<string>('webserver.hostname'), |
150 | PORT: config.get<number>('webserver.port') | 150 | PORT: config.get<number>('webserver.port') |
151 | }, | 151 | }, |
152 | OAUTH2: { | ||
153 | TOKEN_LIFETIME: { | ||
154 | ACCESS_TOKEN: parseDurationToMs(config.get<string>('oauth2.token_lifetime.access_token')), | ||
155 | REFRESH_TOKEN: parseDurationToMs(config.get<string>('oauth2.token_lifetime.refresh_token')) | ||
156 | } | ||
157 | }, | ||
152 | RATES_LIMIT: { | 158 | RATES_LIMIT: { |
153 | API: { | 159 | API: { |
154 | WINDOW_MS: parseDurationToMs(config.get<string>('rates_limit.api.window')), | 160 | WINDOW_MS: parseDurationToMs(config.get<string>('rates_limit.api.window')), |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index ec5045078..0dab524d9 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -101,11 +101,6 @@ const SORTABLE_COLUMNS = { | |||
101 | VIDEO_REDUNDANCIES: [ 'name' ] | 101 | VIDEO_REDUNDANCIES: [ 'name' ] |
102 | } | 102 | } |
103 | 103 | ||
104 | const OAUTH_LIFETIME = { | ||
105 | ACCESS_TOKEN: 3600 * 24, // 1 day, for upload | ||
106 | REFRESH_TOKEN: 1209600 // 2 weeks | ||
107 | } | ||
108 | |||
109 | const ROUTE_CACHE_LIFETIME = { | 104 | const ROUTE_CACHE_LIFETIME = { |
110 | FEEDS: '15 minutes', | 105 | FEEDS: '15 minutes', |
111 | ROBOTS: '2 hours', | 106 | ROBOTS: '2 hours', |
@@ -1033,7 +1028,6 @@ export { | |||
1033 | JOB_ATTEMPTS, | 1028 | JOB_ATTEMPTS, |
1034 | AP_CLEANER, | 1029 | AP_CLEANER, |
1035 | LAST_MIGRATION_VERSION, | 1030 | LAST_MIGRATION_VERSION, |
1036 | OAUTH_LIFETIME, | ||
1037 | CUSTOM_HTML_TAG_COMMENTS, | 1031 | CUSTOM_HTML_TAG_COMMENTS, |
1038 | STATS_TIMESERIE, | 1032 | STATS_TIMESERIE, |
1039 | BROADCAST_CONCURRENCY, | 1033 | BROADCAST_CONCURRENCY, |