feat: added dockerfile, added docker for readme, fixed folders for docker
Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
parent
2cc635d2d0
commit
6b5acdb1bc
5 changed files with 46 additions and 9 deletions
|
@ -23,6 +23,7 @@ import java.io.*
|
|||
import java.util.*
|
||||
|
||||
object CredentialManager {
|
||||
private const val foldername = "data"
|
||||
private const val filename = "credentials.nils"
|
||||
var token: String = "empty"
|
||||
var linkip: String = "empty"
|
||||
|
@ -30,13 +31,18 @@ object CredentialManager {
|
|||
|
||||
///Load the needed credentials, generate a config if there is none
|
||||
fun load() {
|
||||
val configFile = File(filename)
|
||||
val folder = File(foldername)
|
||||
if (!folder.exists()) {
|
||||
save()
|
||||
return
|
||||
}
|
||||
val configFile = File(folder, filename)
|
||||
if (!configFile.exists()) {
|
||||
save()
|
||||
return
|
||||
}
|
||||
try {
|
||||
val input: InputStream = FileInputStream(filename)
|
||||
val input: InputStream = FileInputStream(foldername + File.separator + filename)
|
||||
val prop = Properties()
|
||||
prop.load(input)
|
||||
token = if (prop.getProperty("token").equals("empty")) "empty" else prop.getProperty("token")
|
||||
|
@ -50,7 +56,15 @@ object CredentialManager {
|
|||
|
||||
///generate a new sample config
|
||||
private fun save() {
|
||||
val configFile = File(filename)
|
||||
val folder = File(foldername)
|
||||
if (!folder.exists()) {
|
||||
try {
|
||||
folder.mkdirs()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
val configFile = File(foldername + File.separator + filename)
|
||||
if (!configFile.exists()) {
|
||||
try {
|
||||
configFile.createNewFile()
|
||||
|
@ -59,7 +73,7 @@ object CredentialManager {
|
|||
}
|
||||
}
|
||||
try {
|
||||
val output: OutputStream = FileOutputStream(filename)
|
||||
val output: OutputStream = FileOutputStream(foldername + File.separator + filename)
|
||||
val prop = Properties()
|
||||
prop.setProperty("token", "empty")
|
||||
prop.setProperty("lavaip", "empty")
|
||||
|
@ -70,5 +84,4 @@ object CredentialManager {
|
|||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,5 +16,3 @@
|
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
org.slf4j.simpleLogger.defaultLogLevel=trace
|
||||
org.slf4j.simpleLogger.showDateTime=true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue