added actual json to default config
This commit is contained in:
@@ -2,12 +2,38 @@
|
||||
|
||||
require "option_parser"
|
||||
require "http/server"
|
||||
require "json"
|
||||
|
||||
module Kotatsu
|
||||
VERSION = "0.1.0"
|
||||
CONFIG_DIR = Path.new(Path.home, ".config", "kotatsu")
|
||||
CONFIG_FILE = Path.new(CONFIG_DIR, "config.json")
|
||||
|
||||
def self.buildConfig()
|
||||
conf = JSON.build do |json|
|
||||
json.object do
|
||||
json.field "config_version", 1
|
||||
json.field "port", 8080
|
||||
json.field "title", "Kotatsu"
|
||||
json.field "services" do
|
||||
json.array do
|
||||
json.array do
|
||||
json.string "Peko! Peko! Peko!"
|
||||
json.string "https://peko.dance/"
|
||||
json.string "none"
|
||||
end
|
||||
json.array do
|
||||
json.string "Entertainment Company"
|
||||
json.string "https://hololive.dance/"
|
||||
json.string "none"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return conf
|
||||
end
|
||||
|
||||
def self.makeConfig(file, dir)
|
||||
puts "Creating new config file in #{file}"
|
||||
if Dir.exists?(dir) == false
|
||||
@@ -17,7 +43,7 @@ module Kotatsu
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
File.write(file, VERSION)
|
||||
File.write(file, buildConfig())
|
||||
if File.exists?(file) == false
|
||||
STDERR.puts "ERROR! Could not create file: #{file}"
|
||||
exit(1)
|
||||
|
||||
Reference in New Issue
Block a user