Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks
Commits
28b1e5d5
Commit
28b1e5d5
authored
May 31, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: apollo配置文件引入方式调整
parent
7f02c92a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
11 deletions
+38
-11
.gitignore
.gitignore
+1
-0
editor.ts
app/controller/editor.ts
+5
-5
apollo.js
bin/apollo.js
+20
-0
server.js
bin/server.js
+9
-4
config.sit.ts
config/config.sit.ts
+2
-2
package.json
package.json
+1
-0
No files found.
.gitignore
View file @
28b1e5d5
...
...
@@ -18,6 +18,7 @@ config/plugin.local.js
config/plugin.js
config/config.*.js
config/apollo.json
config/apollo.ssr.json
index.js
config/manifest.json
app/view/*
...
...
app/controller/editor.ts
View file @
28b1e5d5
...
...
@@ -9,12 +9,12 @@ export default class EditorController extends Controller {
}
public
async
home
(
ctx
:
Context
)
{
let
cfg
=
{};
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
const
{
api
,
qiniu
}
=
await
import
(
path
.
resolve
(
'
./config/apollo.json
'
));
cfg
=
{
apollo
:
{...
api
,
...
qiniu
}
};
let
apollo
=
{};
if
(
process
.
env
.
NODE_ENV
===
'
production
'
&&
process
.
env
.
EGG_SERVER_ENV
===
'
sit
'
)
{
apollo
=
ctx
.
app
.
config
.
apollo
||
{};
}
await
ctx
.
renderClient
(
'
editor.js
'
,
cfg
);
await
ctx
.
renderClient
(
'
editor.js
'
,
{
apollo
});
}
public
async
save
(
ctx
:
Context
)
{
...
...
bin/apollo.js
0 → 100644
View file @
28b1e5d5
#!/usr/bin/env node
"
use strict
"
;
const
path
=
require
(
'
path
'
);
const
fs
=
require
(
'
fs
'
);
const
apollo
=
require
(
'
@qg/apollo-nodejs
'
);
const
npm
=
require
(
"
npm
"
);
npm
.
load
(()
=>
{
apollo
.
load
({
appId
:
'
quantum-block-h5
'
,
configPath
:
path
.
resolve
(
__dirname
,
'
../config
'
),
}).
then
(()
=>
{
const
{
api
,
qiniu
}
=
require
(
path
.
resolve
(
'
./config/apollo.json
'
));
fs
.
writeFileSync
(
path
.
resolve
(
'
./config/apollo.ssr.json
'
),
JSON
.
stringify
({
...
api
,
...
qiniu
}));
});
});
\ No newline at end of file
bin/server.js
View file @
28b1e5d5
#!/usr/bin/env node
"
use strict
"
;
const
path
=
require
(
'
path
'
);
const
fs
=
require
(
'
fs
'
);
const
apollo
=
require
(
'
@qg/apollo-nodejs
'
);
"
use strict
"
;
const
npm
=
require
(
"
npm
"
);
npm
.
load
(()
=>
{
apollo
.
load
({
appId
:
'
quantum-block
s
'
,
appId
:
'
quantum-block
-h5
'
,
configPath
:
path
.
resolve
(
__dirname
,
'
../config
'
),
}).
then
(()
=>
{
console
.
log
(
"
>>> apollo file
"
,
require
(
path
.
resolve
(
'
./config/apollo.json
'
)));
const
{
api
,
qiniu
}
=
require
(
path
.
resolve
(
'
./config/apollo.json
'
));
fs
.
writeFileSync
(
path
.
resolve
(
'
./config/apollo.ssr.json
'
),
JSON
.
stringify
({
...
api
,
...
qiniu
}));
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
npm
.
run
(
"
start
"
);
}
else
{
npm
.
run
(
"
test
"
);
}
});
});
\ No newline at end of file
});
\ No newline at end of file
config/config.sit.ts
View file @
28b1e5d5
...
...
@@ -2,8 +2,8 @@
const
path
=
require
(
'
path
'
);
import
{
Application
,
EggAppConfig
}
from
'
egg
'
;
const
{
mysql
,
redis
,
api
,
qiniu
}
=
require
(
path
.
resolve
(
'
./config/apollo.json
'
));
export
default
(
appInfo
:
EggAppConfig
)
=>
{
const
{
mysql
,
redis
}
=
require
(
path
.
resolve
(
'
./config/apollo.json
'
));
const
exports
:
any
=
{};
exports
.
logger
=
{
dir
:
'
/home/quant_group/logs
'
,
...
...
@@ -20,5 +20,5 @@ export default (appInfo: EggAppConfig) => {
},
client
:
redis
};
return
exports
;
return
{...
exports
,
apollo
:
{
...
api
,
...
qiniu
}}
;
};
package.json
View file @
28b1e5d5
...
...
@@ -9,6 +9,7 @@
"backend"
:
"nohup egg-scripts start --port 7001 --workers 4"
,
"dev"
:
"egg-bin dev -r egg-ts-helper/register"
,
"debug"
:
"egg-bin debug -r egg-ts-helper/register"
,
"apollo"
:
"node bin/apollo.js"
,
"build"
:
"easy build --devtool"
,
"tsc"
:
"ets && tsc -p tsconfig.json"
,
"clean"
:
"ets clean"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment