File tree Expand file tree Collapse file tree 6 files changed +64
-6
lines changed
Expand file tree Collapse file tree 6 files changed +64
-6
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "trailingComma": "es5",
3+ "singleQuote": true,
4+ "bracketSpacing": false,
5+ "printWidth": 120
6+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ docker run -d \
3030-v /home/user/.ssh/authorized_keys:/root/.ssh/authorized_keys:ro
3131
3232# this is your private key used for JWT encryption
33+ # you can set this to any string you want (a long random string generated by your password manager is recommended)
3334-e EXO_PRIVATE_KEY=your_jwt_encryption_key
3435
3536# this is used to tell traefik to which deployment current docker service belongs
Original file line number Diff line number Diff line change 11{
22 "name" : " exoframe" ,
3- "version" : " 5.1.0 " ,
3+ "version" : " 5.1.1-dev " ,
44 "description" : " Exoframe is a self-hosted tool that allows simple one-command deployments using Docker" ,
55 "main" : " index.js" ,
66 "repository" :
" [email protected] :exoframejs/exoframe.git" ,
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ exports.builder = {
9696 description : 'Verbose mode; will output more information' ,
9797 count : true ,
9898 } ,
99+ endpoint : {
100+ alias : 'e' ,
101+ description : 'Exoframe server endpoint to use (will override config value)' ,
102+ } ,
99103} ;
100104exports . handler = async ( args = { } ) => {
101105 const deployToken = args . token ;
@@ -108,16 +112,14 @@ exports.handler = async (args = {}) => {
108112
109113 const folder = args . _ ? args . _ . filter ( arg => arg !== 'deploy' ) . shift ( ) : undefined ;
110114 const update = args . update ;
115+ const endpoint = args . endpoint || userConfig . endpoint ;
111116
112- console . log (
113- chalk . bold ( `${ update ? 'Updating' : 'Deploying' } ${ folder || 'current project' } to endpoint:` ) ,
114- userConfig . endpoint
115- ) ;
117+ console . log ( chalk . bold ( `${ update ? 'Updating' : 'Deploying' } ${ folder || 'current project' } to endpoint:` ) , endpoint ) ;
116118
117119 // create config vars
118120 const workdir = folder ? path . join ( process . cwd ( ) , folder ) : process . cwd ( ) ;
119121 const folderName = path . basename ( workdir ) ;
120- const remoteUrl = `${ userConfig . endpoint } /${ update ? 'update' : 'deploy' } ` ;
122+ const remoteUrl = `${ endpoint } /${ update ? 'update' : 'deploy' } ` ;
121123
122124 // make sure workdir exists
123125 if ( ! fs . existsSync ( workdir ) ) {
Original file line number Diff line number Diff line change @@ -47,6 +47,23 @@ Array [
4747]
4848` ;
4949
50+ exports [` Should deploy with endpoint flag 1` ] = `
51+ Array [
52+ Array [
53+ "[1mDeploying test/fixtures/test_html_project to endpoint:[22m",
54+ "http://localhost:3000",
55+ ],
56+ Array [
57+ "Your project is now deployed as:
58+ ",
59+ ],
60+ Array [
61+ "[31m ID [39m[90m [39m[31m URL [39m[90m [39m[31m Hostname [39m[90m [39m[31m Type [39m
62+ test [90m [39m localhost [90m [39m test [90m [39m Container ",
63+ ],
64+ ]
65+ ` ;
66+
5067exports [` Should deploy without auth but with token 1` ] = `
5168Array [
5269 Array [
Original file line number Diff line number Diff line change @@ -92,6 +92,38 @@ test('Should deploy', done => {
9292 } ) ;
9393} ) ;
9494
95+ // test
96+ test ( 'Should deploy with endpoint flag' , done => {
97+ // spy on console
98+ const consoleSpy = sinon . spy ( console , 'log' ) ;
99+
100+ // handle correct request
101+ const deployServer = nock ( 'http://localhost:3000' )
102+ . post ( '/deploy' )
103+ . reply ( ( uri , requestBody ) => {
104+ const excgf = fs . readFileSync ( path . join ( testFolder , 'exoframe.json' ) ) ;
105+ const index = fs . readFileSync ( path . join ( testFolder , 'index.html' ) ) ;
106+ expect ( requestBody ) . toContain ( excgf ) ;
107+ expect ( requestBody ) . toContain ( index ) ;
108+
109+ return replyWithStream ( [ { message : 'Deployment success!' , deployments, level : 'info' } ] ) ;
110+ } ) ;
111+
112+ // execute login
113+ deploy ( { _ : [ folderPath ] , endpoint : 'http://localhost:3000' } ) . then ( ( ) => {
114+ // make sure log in was successful
115+ // check that server was called
116+ expect ( deployServer . isDone ( ) ) . toBeTruthy ( ) ;
117+ // first check console output
118+ expect ( consoleSpy . args ) . toMatchSnapshot ( ) ;
119+ // restore console
120+ console . log . restore ( ) ;
121+ // tear down nock
122+ deployServer . done ( ) ;
123+ done ( ) ;
124+ } ) ;
125+ } ) ;
126+
95127// test
96128test ( 'Should deploy without path' , done => {
97129 // spy on console
You can’t perform that action at this time.
0 commit comments