Skip to content
Snippets Groups Projects
Verified Commit b63a8b22 authored by Ole Binder's avatar Ole Binder
Browse files

Refactor: replace ini config with yaml config

parent 53372327
No related branches found
No related tags found
1 merge request!17Yaml configuration file
Pipeline #7772 failed
......@@ -29,8 +29,8 @@ RUN mkdir -p /srv/src /srv/tests /srv/config srv/logs srv/socket /var/audio
RUN mkdir -p /etc/wireplumber/scripts
COPY src /srv/src
COPY tests /srv/tests
COPY config/sample.engine-core.docker.ini /srv/config/engine-core.ini
COPY config/sample-production.engine-core.ini /srv/config/sample-production.engine-core.ini
# COPY config/sample.engine-core.docker.ini /srv/config/engine-core.ini
# COPY config/sample-production.engine-core.ini /srv/config/sample-production.engine-core.ini
COPY Makefile /srv/Makefile
COPY VERSION /srv/VERSION
COPY scripts/wireplumber /etc/wireplumber/scripts
......
......@@ -2,7 +2,7 @@ general:
engine_id: "1"
socket_dir: "../socket"
log_dir: "../logs"
log_level: "3"
log_level: "INFO"
liquidsoap_as_root: false
liquidsoap_min_version: "2.2.4"
api_url_playlog: "http://127.0.0.1:8008/api/v1/playlog"
......@@ -11,10 +11,10 @@ telnet:
server_enable: true
server_timeout: 16380
server_host: "127.0.0.1"
server_port: "1234"
server_port: 1234
fallback:
music_folder: "../audio/fallback"
music_folder: "/var/audio/fallback"
show_name: "Station Fallback"
show_id: "-1"
type: "folder"
......
version: "3.4"
services:
engine-core:
container_name: engine-core
......@@ -66,6 +64,7 @@ services:
- ${AURA_AUDIO_STORE_PLAYLIST}:/var/audio/playlist
- ${AURA_AUDIO_STORE_FALLBACK}:/var/audio/fallback
- ${AURA_LOGS}:/srv/logs
- ./config/engine-core.yaml:/etc/aura/engine-core.yaml
- aura_engine_socket:/srv/socket
tmpfs:
- /tmp
......
......@@ -83,7 +83,8 @@ output_source = attach_fallback_source(stripped_stream)
%include "out_soundcard.liq"
# stream output
%include "out_stream.liq"
# FIXME: this needs to be refactored
# %include "out_stream.liq"
# enable socket functions
%include "serverfunctions.liq"
......@@ -83,10 +83,9 @@ end
if a0_in != "" then create_input_line("in_line_0", a0_in) end
if a1_in != "" then create_input_line("in_line_1", a1_in) end
# if a1_in != "" then create_input_line("in_line_1", a1_in) end
if a2_in != "" then create_input_line("in_line_2", a2_in) end
# if a2_in != "" then create_input_line("in_line_2", a2_in) end
if a3_in != "" then create_input_line("in_line_3", a3_in) end
if a4_in != "" then create_input_line("in_line_4", a4_in) end
# if a3_in != "" then create_input_line("in_line_3", a3_in) end
\ No newline at end of file
......@@ -16,30 +16,27 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if a0_out != "" then ignore(get_output(output_source, a0_out, "lineout_0")) end
# if a1_out != "" then
# ignore(get_output(output_source, a1_out, "lineout_1"))
# end
if a0_out != "" then
ignore(get_output(output_source, a0_out, "lineout_0"))
end
# if a2_out != "" then
# ignore(get_output(output_source, a2_out, "lineout_2"))
# end
if a1_out != "" then
ignore(get_output(output_source, a1_out, "lineout_1"))
end
# if a3_out != "" then
# ignore(get_output(output_source, a3_out, "lineout_3"))
# end
if a2_out != "" then
ignore(get_output(output_source, a2_out, "lineout_2"))
end
# if a4_out != "" then
# ignore(get_output(output_source, a4_out, "lineout_4"))
if a3_out != "" then
ignore(get_output(output_source, a3_out, "lineout_3"))
end
# #output_4 = ref output.dummy(blank())
# #get_output(output_4, output_source, a4_out, "lineout_4")
if a4_out != "" then
ignore(get_output(output_source, a4_out, "lineout_4"))
#output_4 = ref output.dummy(blank())
#get_output(output_4, output_source, a4_out, "lineout_4")
#output_4 := get_output(output_source, a4_out, "lineout_4")
#get_output(output_source, a4_out, "aura_lineout_4")
end
# #output_4 := get_output(output_source, a4_out, "lineout_4")
# #get_output(output_source, a4_out, "aura_lineout_4")
# end
\ No newline at end of file
......@@ -120,8 +120,7 @@ server.register(
so = []
so =
s0_enable
? list.add(("out_line_0", ("connected", "#{s0_connected()}")), so) : so
s0_enable ? list.add(("out_line_0", ("connected", "stream0")), so) : so
# so =
# s1_enable
# ? list.add(("out_line_1", ("connected", "#{s1_connected()}")), so) : so
......@@ -137,11 +136,11 @@ server.register(
lo = []
lo = a0_out != '' ? list.add("out_line_0", lo) : lo
lo = a1_out != '' ? list.add("out_line_1", lo) : lo
lo = a2_out != '' ? list.add("out_line_2", lo) : lo
lo = a3_out != '' ? list.add("out_line_3", lo) : lo
lo = a4_out != '' ? list.add("out_line_4", lo) : lo
# lo = a1_out != '' ? list.add("out_line_1", lo) : lo
# lo = a2_out != '' ? list.add("out_line_2", lo) : lo
# lo = a3_out != '' ? list.add("out_line_3", lo) : lo
# lo = a4_out != '' ? list.add("out_line_4", lo) : lo
json_data = json()
json_data.add("line", lo)
json_data.add("stream", so)
......@@ -235,96 +234,97 @@ server.register(
fadeTo
)
def icy_update(v) =
# Parse the argument
l = string.split(separator=",", v)
def split(l, v) =
v = string.split(separator="=", v)
if
list.length(v) >= 2
then
list.append(l, [(list.nth(v, 0, default=""), list.nth(v, 1, default=""))])
else
l
end
end
meta = list.fold(split, [], l)
# def icy_update(v) =
# # Parse the argument
# l = string.split(separator=",", v)
# def split(l, v) =
# v = string.split(separator="=", v)
# if
# list.length(v) >= 2
# then
# list.append(l, [(list.nth(v, 0, default=""), list.nth(v, 1, default=""))])
# else
# l
# end
# end
# meta = list.fold(split, [], l)
# Update metadata
if
s0_enable == true
then
icy.update_metadata(
mount=s0_mount,
user=s0_user,
password=s0_pass,
host=s0_host,
port=s0_port,
meta
)
end
# # Update metadata
# if
# s0_enable == true
# then
# icy.update_metadata(
# mount=s0_mount,
# user=s0_user,
# password=s0_pass,
# host=s0_host,
# port=s0_port,
# meta
# )
# end
# if
# s1_enable == true
# then
# icy.update_metadata(
# mount=s1_mount,
# user=s1_user,
# password=s1_pass,
# host=s1_host,
# port=s1_port,
# meta
# )
# end
# if
# s1_enable == true
# then
# icy.update_metadata(
# mount=s1_mount,
# user=s1_user,
# password=s1_pass,
# host=s1_host,
# port=s1_port,
# meta
# )
# end
# if
# s2_enable == true
# then
# icy.update_metadata(
# mount=s2_mount,
# user=s2_user,
# password=s2_pass,
# host=s2_host,
# port=s2_port,
# meta
# )
# end
# if
# s2_enable == true
# then
# icy.update_metadata(
# mount=s2_mount,
# user=s2_user,
# password=s2_pass,
# host=s2_host,
# port=s2_port,
# meta
# )
# end
# if
# s3_enable == true
# then
# icy.update_metadata(
# mount=s3_mount,
# user=s3_user,
# password=s3_pass,
# host=s3_host,
# port=s3_port,
# meta
# )
# end
# if
# s3_enable == true
# then
# icy.update_metadata(
# mount=s3_mount,
# user=s3_user,
# password=s3_pass,
# host=s3_host,
# port=s3_port,
# meta
# )
# end
# if
# s4_enable == true
# then
# icy.update_metadata(
# mount=s4_mount,
# user=s4_user,
# password=s4_pass,
# host=s4_host,
# port=s4_port,
# meta
# )
# end
# if
# s4_enable == true
# then
# icy.update_metadata(
# mount=s4_mount,
# user=s4_user,
# password=s4_pass,
# host=s4_host,
# port=s4_port,
# meta
# )
# end
"OK"
end
# "OK"
# end
server.register(
"update",
namespace="metadata",
description=
"Update metadata",
usage=
"update title=foo,album=bar, ...",
icy_update
)
# server.register(
# "update",
# namespace="metadata",
# description=
# "Update metadata",
# usage=
# "update title=foo,album=bar, ...",
# icy_update
# )
\ No newline at end of file
......@@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# READ INI FILE
%include "parse_yaml.liq"
default_config = "../config/engine-core.yaml"
config_file =
list.hd(
......@@ -45,7 +44,7 @@ let yaml.parse (config :
server_enable: bool,
server_timeout: float,
server_host: string,
server_port: string
server_port: float
},
fallback: {
music_folder: string,
......@@ -81,7 +80,7 @@ let yaml.parse (config :
}
}
) = file.contents(config_file)
ini
engine_config_folder = string.split(separator="/engine-core.yaml", config_file)
engine_config_folder = list.nth(default="../config/", engine_config_folder, 0)
print(
......@@ -158,7 +157,7 @@ else
config.telnet.server_port
} (#{config.telnet.server_timeout}s timeout)"
)
settings.server.telnet.bind_addr.set(telnet_server_host)
settings.server.telnet.bind_addr.set(config.telnet.server_host)
settings.server.telnet.port.set(int_of_float(config.telnet.server_port))
settings.server.telnet.set(true)
end
......@@ -203,7 +202,7 @@ log_level =
end
# log_level = get_setting("3", "log_level", "AURA_ENGINE_CORE_LOG_LEVEL")
settings.log.level.set(og_level)
settings.log.level.set(log_level)
# log_dir = get_setting("../logs", "log_dir", "AURA_ENGINE_CORE_LOG_DIR")
log_file = "#{config.general.log_dir}/engine-core.log"
......@@ -224,7 +223,7 @@ log(
# socket_dir = get_setting("../socket", "socket_dir", "AURA_ENGINE_SOCKET_DIR")
socket_file = "#{config.general.socket_dir}/engine.sock"
if
socket_dir != ""
config.general.socket_dir != ""
then
log(
"\tSocket location: '#{socket_file}'"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment