Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Kitsukey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kio!
Kitsukey
Commits
b6ef2fcb
Commit
b6ef2fcb
authored
8 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
#31
parent
09003362
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
gulpfile.ts
+2
-2
2 additions, 2 deletions
gulpfile.ts
src/config.ts
+8
-10
8 additions, 10 deletions
src/config.ts
src/globals.d.ts
+0
-11
0 additions, 11 deletions
src/globals.d.ts
src/server.ts
+2
-0
2 additions, 0 deletions
src/server.ts
with
12 additions
and
23 deletions
gulpfile.ts
+
2
−
2
View file @
b6ef2fcb
...
...
@@ -36,9 +36,9 @@ if (!fs.existsSync('./.config/config.yml')) {
process
.
exit
();
}
(
global
as
any
).
MISSKEY_CONFIG_PATH
=
'
.config/config.yml
'
;
import
{
IConfig
}
from
'
./src/config
'
;
const
config
=
eval
(
require
(
'
typescript
'
).
transpile
(
require
(
'
fs
'
).
readFileSync
(
'
./src/config.ts
'
).
toString
()))
(
'
.config/config.yml
'
)
as
IConfig
;
const
config
=
eval
(
require
(
'
typescript
'
).
transpile
(
require
(
'
fs
'
).
readFileSync
(
'
./src/config.ts
'
).
toString
()))
as
IConfig
;
const
tsProject
=
ts
.
createProject
(
'
tsconfig.json
'
);
...
...
This diff is collapsed.
Click to expand it.
src/config.ts
+
8
−
10
View file @
b6ef2fcb
...
...
@@ -62,12 +62,10 @@ interface Mixin {
export
type
IConfig
=
ISource
&
Mixin
;
/**
* 設定を取得します
* @param {string} path 設定ファイルのパス
* @return {IConfig} 設定
*/
export
default
(
path
:
string
)
=>
{
export
default
load
();
function
load
()
{
const
path
=
(
global
as
any
).
MISSKEY_CONFIG_PATH
?
(
global
as
any
).
MISSKEY_CONFIG_PATH
:
`
${
__dirname
}
/../.config/config.yml`
;
const
config
=
yaml
.
safeLoad
(
fs
.
readFileSync
(
path
,
'
utf8
'
))
as
ISource
;
const
mixin
:
Mixin
=
{}
as
Mixin
;
...
...
@@ -90,14 +88,14 @@ export default (path: string) => {
mixin
.
dev_url
=
`
${
mixin
.
scheme
}
://dev.
${
mixin
.
host
}
`
;
mixin
.
drive_url
=
`
${
mixin
.
secondary_scheme
}
://file.
${
mixin
.
secondary_host
}
`
;
return
Object
.
assign
(
config
||
{}
,
mixin
)
as
IConfig
;
}
;
return
Object
.
assign
(
config
,
mixin
);
}
function
normalizeUrl
(
url
:
string
)
:
string
{
function
normalizeUrl
(
url
:
string
)
{
return
url
[
url
.
length
-
1
]
===
'
/
'
?
url
.
substr
(
0
,
url
.
length
-
1
)
:
url
;
}
function
urlError
(
url
:
string
)
:
void
{
function
urlError
(
url
:
string
)
{
console
.
error
(
`「
${
url
}
」は、正しいURLではありません。先頭に http:// または https:// をつけ忘れてないかなど確認してください。`
);
process
.
exit
();
}
This diff is collapsed.
Click to expand it.
src/globals.d.ts
deleted
100644 → 0
+
0
−
11
View file @
09003362
import
*
as
mongodb
from
'
mongodb
'
;
import
{
IConfig
}
from
'
./config
'
;
declare
var
config
:
IConfig
;
declare
module
NodeJS
{
interface
Global
{
config
:
IConfig
;
db
:
mongodb
.
Db
;
}
}
This diff is collapsed.
Click to expand it.
src/server.ts
+
2
−
0
View file @
b6ef2fcb
...
...
@@ -8,6 +8,8 @@ import * as https from 'https';
import
*
as
express
from
'
express
'
;
import
vhost
=
require
(
'
vhost
'
);
import
config
from
'
./config
'
;
/**
* Init app
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment