mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-18 02:09:49 +00:00
Merge pull request #142 from JacekJagosz/master
Make Sunshine on Linux stateless
This commit is contained in:
commit
da3ed5ff79
@ -230,6 +230,14 @@ if(NOT SUNSHINE_ASSETS_DIR)
|
||||
set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
||||
endif()
|
||||
|
||||
if(NOT SUNSHINE_CONFIG_DIR)
|
||||
set(SUNSHINE_CONFIG_DIR SUNSHINE_ASSETS_DIR)
|
||||
endif()
|
||||
|
||||
if(NOT SUNSHINE_DEFAULT_DIR)
|
||||
set(SUNSHINE_DEFAULT_DIR SUNSHINE_ASSETS_DIR)
|
||||
endif()
|
||||
|
||||
list(APPEND CBS_EXTERNAL_LIBRARIES
|
||||
cbs)
|
||||
|
||||
@ -246,6 +254,8 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
${PLATFORM_LIBRARIES})
|
||||
|
||||
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR}")
|
||||
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR}")
|
||||
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_DEFAULT_DIR="${SUNSHINE_DEFAULT_DIR}")
|
||||
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
||||
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES})
|
||||
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
|
||||
|
@ -20,7 +20,7 @@ using namespace std::literals;
|
||||
#define PRIVATE_KEY_FILE CA_DIR "/cakey.pem"
|
||||
#define CERTIFICATE_FILE CA_DIR "/cacert.pem"
|
||||
|
||||
#define APPS_JSON_PATH SUNSHINE_ASSETS_DIR "/" APPS_JSON
|
||||
#define APPS_JSON_PATH SUNSHINE_CONFIG_DIR "/" APPS_JSON
|
||||
namespace config {
|
||||
|
||||
namespace nv {
|
||||
@ -227,7 +227,7 @@ sunshine_t sunshine {
|
||||
{}, // Username
|
||||
{}, // Password
|
||||
{}, // Password Salt
|
||||
SUNSHINE_ASSETS_DIR "/sunshine.conf", // config file
|
||||
SUNSHINE_CONFIG_DIR "/sunshine.conf", // config file
|
||||
{}, // cmd args
|
||||
47989,
|
||||
};
|
||||
@ -577,6 +577,10 @@ int apply_flags(const char *line) {
|
||||
}
|
||||
|
||||
void apply_config(std::unordered_map<std::string, std::string> &&vars) {
|
||||
if(!fs::exists(stream.file_apps.c_str())) {
|
||||
fs::copy_file(SUNSHINE_DEFAULT_DIR "/" APPS_JSON, stream.file_apps);
|
||||
}
|
||||
|
||||
for(auto &[name, val] : vars) {
|
||||
std::cout << "["sv << name << "] -- ["sv << val << ']' << std::endl;
|
||||
}
|
||||
@ -759,6 +763,10 @@ int parse(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!fs::exists(sunshine.config_file.c_str())) {
|
||||
fs::copy_file(SUNSHINE_DEFAULT_DIR "/sunshine.conf", sunshine.config_file);
|
||||
}
|
||||
|
||||
auto vars = parse_config(read_file(sunshine.config_file.c_str()));
|
||||
|
||||
for(auto &[name, value] : cmd_vars) {
|
||||
|
@ -512,4 +512,4 @@ void start() {
|
||||
|
||||
tcp.join();
|
||||
}
|
||||
} // namespace confighttp
|
||||
} // namespace confighttp
|
||||
|
Loading…
Reference in New Issue
Block a user