Toggle navigation
Toggle navigation
This project
Loading...
Sign in
은승우
/
LINEBOT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
은승우
2019-12-03 19:44:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
65348907979ab560bfa5a0a80db90b584b74ba8b
65348907
1 parent
839b2481
delete greenlock
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
14 deletions
app.js
app.js
View file @
6534890
...
...
@@ -4,26 +4,40 @@ const line = require('@line/bot-sdk');
var
request
=
require
(
'request'
);
var
https
=
require
(
'https'
);
var
http
=
require
(
'http'
);
const
lex
=
require
(
'greenlock-express'
).
create
({
version
:
'draft-11'
,
configDir
:
'/etc/letsencrypt/'
,
email
:
'sweun1@naver.com'
,
agreeTos
:
true
,
approvedDomains
:
[
'oss.chatbot.bu.to'
,
'www.oss.chatbot.bu.to'
],
var
fs
=
require
(
"fs"
);
var
httpsOptions
=
{
key
:
fs
.
readFileSync
(
"/etc/letsencrypt/live/oss.chatbot.bu.to/privkey.pem"
),
cert
:
fs
.
readFileSync
(
"/etc/letsencrypt/live/oss.chatbot.bu.to/cert.pem"
)
};
http
.
createServer
(
app
).
listen
(
80
);
https
.
createServer
(
httpsOptions
,
app
).
listen
(
443
);
/* if ssl expired
var greenlock= require('greenlock-express');
const lex = greenlock .create({
version: 'draft-11', // 버전2
store: require('greenlock-store-fs'),
configDir: '/etc/letsencrypt', // 또는 ~/letsencrypt/etc
approveDomains: (opts, certs, cb) => {
if (certs) {
opts.domains = ['oss.chatbot.bu.to', 'www.oss.chatbot.bu.to'];
} else {
opts.email = 'sweun1@naver.com';
opts.agreeTos = true;
}
cb(null, { options: opts, certs });
},
renewWithin: 81 * 24 * 60 * 60 * 1000,
renewBy: 80 * 24 * 60 * 60 * 1000,
}).
listen
(
80
,
443
);
});*/
//papago api
https
.
createServer
(
lex
.
httpsOptions
,
lex
.
middleware
(
app
)).
listen
((
process
.
env
.
SSL_PORT
||
443
),()
=>
{
console
.
log
(
"server on 443"
);
});
http
.
createServer
(
lex
.
middleware
(
require
(
'redirect-https'
)())).
listen
(
process
.
env
.
PORT
||
80
,()
=>
{
console
.
log
(
"server on 80"
);
});
//번역 api_url
var
translate_api_url
=
'https://openapi.naver.com/v1/papago/n2mt'
;
...
...
Please
register
or
login
to post a comment