Showing
1 changed file
with
22 additions
and
2 deletions
... | @@ -8,6 +8,11 @@ const PAPAGO_ID = 'tA41WEd_nbzy0nZcUQks' | ... | @@ -8,6 +8,11 @@ const PAPAGO_ID = 'tA41WEd_nbzy0nZcUQks' |
8 | const PAPAGO_SECRET = '6DHwov9gg2' | 8 | const PAPAGO_SECRET = '6DHwov9gg2' |
9 | const WEATHER_TARGET_URL = 'http://apis.data.go.kr/1360000/VilageFcstInfoService/getVilageFcst'; | 9 | const WEATHER_TARGET_URL = 'http://apis.data.go.kr/1360000/VilageFcstInfoService/getVilageFcst'; |
10 | const weather_key = 'CuIdcpULvcissE3Jk7AyAXok4bR4j6xyNkhfmWxOI9%2BxCs%2FkI%2F4v4j4rz3DDsQZVeuJTrWQhzQ3CV4JkeykMSw%3D%3D'; | 10 | const weather_key = 'CuIdcpULvcissE3Jk7AyAXok4bR4j6xyNkhfmWxOI9%2BxCs%2FkI%2F4v4j4rz3DDsQZVeuJTrWQhzQ3CV4JkeykMSw%3D%3D'; |
11 | +const fs = require('fs'); | ||
12 | +const path = require('path'); | ||
13 | +const HTTPS = require('https'); | ||
14 | +const domain = "www.theia17.tk" | ||
15 | +const sslport = 23023; | ||
11 | const bodyParser = require('body-parser'); | 16 | const bodyParser = require('body-parser'); |
12 | var app = express(); | 17 | var app = express(); |
13 | var async = require('async'); | 18 | var async = require('async'); |
... | @@ -382,6 +387,21 @@ function weather_get (url, User_Location) | ... | @@ -382,6 +387,21 @@ function weather_get (url, User_Location) |
382 | }); | 387 | }); |
383 | } | 388 | } |
384 | 389 | ||
385 | - app.listen(3000, function () { | 390 | +try { |
386 | - console.log('Linebot listening on port 3000!'); | 391 | + const option = { |
392 | + ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'), | ||
393 | + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(), | ||
394 | + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(), | ||
395 | + }; | ||
396 | + | ||
397 | + HTTPS.createServer(option, app).listen(sslport, () => { | ||
398 | + console.log(`[HTTPS] Server is started on port ${sslport}`); | ||
399 | + }); | ||
400 | + } catch (error) { | ||
401 | + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); | ||
402 | + console.log(error); | ||
403 | + } | ||
404 | + | ||
405 | + app.listen(23023, function () { | ||
406 | + console.log('Linebot listening on port 23023!'); | ||
387 | }); | 407 | }); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment