Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BudgetMaster
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
6bb3792c
Commit
6bb3792c
authored
6 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
#333 - create external settings if not existing
parent
e4eef3ed
No related branches found
No related tags found
No related merge requests found
Pipeline
#276
passed
6 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/deadlocker8/budgetmaster/Main.java
+29
-7
29 additions, 7 deletions
src/main/java/de/deadlocker8/budgetmaster/Main.java
src/main/resources/config/templates/settings.properties
+15
-0
15 additions, 0 deletions
src/main/resources/config/templates/settings.properties
with
44 additions
and
7 deletions
src/main/java/de/deadlocker8/budgetmaster/Main.java
+
29
−
7
View file @
6bb3792c
package
de.deadlocker8.budgetmaster
;
import
de.deadlocker8.budgetmaster.utils.Strings
;
import
de.tobias.logger.*
;
import
de.tobias.utils.application.ApplicationUtils
;
import
de.tobias.utils.application.container.PathType
;
import
de.tobias.logger.FileOutputOption
;
import
de.tobias.logger.LogLevel
;
import
de.tobias.logger.LogLevelFilter
;
import
de.tobias.logger.Logger
;
import
de.tobias.utils.io.PathUtils
;
import
de.tobias.utils.util.Localization
;
import
de.tobias.utils.util.SystemUtils
;
import
org.apache.tomcat.jni.Local
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.StandardCopyOption
;
import
java.util.Arrays
;
import
java.util.Locale
;
...
...
@@ -43,11 +48,30 @@ public class Main implements ApplicationRunner
});
Localization
.
load
();
Logger
.
init
(
SystemUtils
.
getApplicationSupportDirectoryPath
(
Localization
.
getString
(
"folder"
)));
Path
applicationSupportFolder
=
SystemUtils
.
getApplicationSupportDirectoryPath
(
Localization
.
getString
(
"folder"
));
PathUtils
.
createDirectoriesIfNotExists
(
applicationSupportFolder
);
Logger
.
init
(
applicationSupportFolder
);
Logger
.
setFileOutput
(
FileOutputOption
.
COMBINED
);
Logger
.
appInfo
(
Localization
.
getString
(
Strings
.
APP_NAME
),
Localization
.
getString
(
Strings
.
VERSION_NAME
),
Localization
.
getString
(
Strings
.
VERSION_CODE
),
Localization
.
getString
(
Strings
.
VERSION_DATE
));
ProgramArgs
.
setArgs
(
Arrays
.
asList
(
args
));
Path
settingsPath
=
applicationSupportFolder
.
resolve
(
"settings.properties"
);
if
(
Files
.
notExists
(
settingsPath
))
{
try
{
Logger
.
warning
(
"BudgetMaster settings file ({0}) is missing. A default file will be created. Please fill in your settings."
,
settingsPath
);
Files
.
copy
(
Main
.
class
.
getClassLoader
().
getResourceAsStream
(
"config/templates/settings.properties"
),
settingsPath
,
StandardCopyOption
.
REPLACE_EXISTING
);
System
.
exit
(
1
);
}
catch
(
IOException
e
)
{
Logger
.
error
(
e
);
}
}
SpringApplication
.
run
(
Main
.
class
,
args
);
}
...
...
@@ -77,7 +101,5 @@ public class Main implements ApplicationRunner
Logger
.
setLevelFilter
(
LogLevelFilter
.
NORMAL
);
Logger
.
setFileOutput
(
FileOutputOption
.
COMBINED
);
}
Logger
.
appInfo
(
Localization
.
getString
(
Strings
.
APP_NAME
),
Localization
.
getString
(
Strings
.
VERSION_NAME
),
Localization
.
getString
(
Strings
.
VERSION_CODE
),
Localization
.
getString
(
Strings
.
VERSION_DATE
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/config/templates/settings.properties
0 → 100644
+
15
−
0
View file @
6bb3792c
### general settings ###
server.port
=
9000
### SSL settings ###
# do not change this property
server.ssl.keyStoreType
=
PKCS12
# set to true if you want to use SSL (highly recommended)
security.require-ssl
=
false
# insert path to the keystore (relative to the location of BudgetMaster jar/exe or as absolute path)
server.ssl.key-store
=
<path_to_keystore>
server.ssl.key-store-password
=
<keystore_password>
server.ssl.keyAlias
=
<keystore_alias>
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