Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Actual Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
Janne Mareike Koschinski
Actual Server
Commits
c20648c3
Commit
c20648c3
authored
3 years ago
by
James Long
Browse files
Options
Downloads
Patches
Plain Diff
Improve bootstrap process
parent
fa329485
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
Dockerfile
+0
-1
0 additions, 1 deletion
Dockerfile
account-db.js
+11
-1
11 additions, 1 deletion
account-db.js
app-sync.js
+4
-4
4 additions, 4 deletions
app-sync.js
load-config.js
+4
-1
4 additions, 1 deletion
load-config.js
sql/default-account.sqlite
+0
-0
0 additions, 0 deletions
sql/default-account.sqlite
with
19 additions
and
7 deletions
Dockerfile
+
0
−
1
View file @
c20648c3
...
...
@@ -12,6 +12,5 @@ ADD . .
RUN
yarn
install
--production
RUN
mkdir
./server-files
RUN
mkdir
./user-files
RUN
cp
./sql/default-account.sqlite ./server-files/account.sqlite
CMD
["yarn", "start"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
account-db.js
+
11
−
1
View file @
c20648c3
let
fs
=
require
(
'
fs
'
);
let
{
join
}
=
require
(
'
path
'
);
let
{
openDatabase
}
=
require
(
'
./db
'
);
let
config
=
require
(
'
./load-config
'
);
let
accountDb
=
null
;
function
getAccountDb
()
{
if
(
accountDb
==
null
)
{
accountDb
=
openDatabase
(
join
(
__dirname
,
'
server-files/account.sqlite
'
));
let
dbPath
=
join
(
config
.
serverFiles
,
'
account.sqlite
'
);
let
needsInit
=
!
fs
.
existsSync
(
dbPath
);
accountDb
=
openDatabase
(
dbPath
);
if
(
needsInit
)
{
let
initSql
=
fs
.
readFileSync
(
join
(
__dirname
,
'
sql/account.sql
'
),
'
utf8
'
);
accountDb
.
exec
(
initSql
);
}
}
return
accountDb
;
...
...
This diff is collapsed.
Click to expand it.
app-sync.js
+
4
−
4
View file @
c20648c3
...
...
@@ -19,7 +19,7 @@ const app = express();
app
.
use
(
errorMiddleware
);
async
function
init
()
{
let
fileDir
=
join
(
__dirname
,
process
.
env
.
ACTUAL_USER_FILES
||
config
.
f
iles
);
let
fileDir
=
join
(
__dirname
,
process
.
env
.
ACTUAL_USER_FILES
||
config
.
userF
iles
);
console
.
log
(
'
Initializing Actual with user file dir:
'
,
fileDir
);
...
...
@@ -279,12 +279,12 @@ app.post('/upload-user-file', async (req, res) => {
// supported yet in the self-hosted version because it's unclear if
// it's still needed, given that you own your server
//
// await fs.writeFile(join(config.
f
iles, `${fileId}.blob`), req.body);
// await fs.writeFile(join(config.
userF
iles, `${fileId}.blob`), req.body);
let
zip
=
new
AdmZip
(
req
.
body
);
try
{
zip
.
extractAllTo
(
join
(
config
.
f
iles
,
fileId
),
true
);
zip
.
extractAllTo
(
join
(
config
.
userF
iles
,
fileId
),
true
);
}
catch
(
err
)
{
console
.
log
(
'
Error writing file
'
,
err
);
res
.
send
(
JSON
.
stringify
({
status
:
'
error
'
}));
...
...
@@ -339,7 +339,7 @@ app.get('/download-user-file', async (req, res) => {
let
zip
=
new
AdmZip
();
try
{
zip
.
addLocalFolder
(
join
(
config
.
f
iles
,
fileId
),
'
/
'
);
zip
.
addLocalFolder
(
join
(
config
.
userF
iles
,
fileId
),
'
/
'
);
}
catch
(
e
)
{
res
.
status
(
500
).
send
(
'
Error reading files
'
);
return
;
...
...
This diff is collapsed.
Click to expand it.
load-config.js
+
4
−
1
View file @
c20648c3
...
...
@@ -3,11 +3,14 @@ try {
config
=
require
(
'
./config
'
);
}
catch
(
e
)
{
let
fs
=
require
(
'
fs
'
);
let
{
join
}
=
require
(
'
path
'
);
let
root
=
fs
.
existsSync
(
'
/data
'
)
?
'
/data
'
:
'
/
'
;
config
=
{
mode
:
'
development
'
,
port
:
5006
,
files
:
fs
.
existsSync
(
'
/data
'
)
?
'
/data
'
:
'
./user-files
'
serverFiles
:
join
(
root
,
'
server-files
'
),
userFiles
:
join
(
root
,
'
user-files
'
)
};
}
...
...
This diff is collapsed.
Click to expand it.
sql/default-account.sqlite
deleted
100644 → 0
+
0
−
0
View file @
fa329485
File deleted
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