Add build command argument
This commit is contained in:
parent
d3f2d25a0f
commit
a589bcb799
4 changed files with 13 additions and 2 deletions
|
@ -3,4 +3,5 @@ DISCORD_TOKEN=
|
||||||
PREFIX="-h "
|
PREFIX="-h "
|
||||||
HUGO=/path/to/hugo
|
HUGO=/path/to/hugo
|
||||||
GUILD_DATA=/path/to/guilds.json
|
GUILD_DATA=/path/to/guilds.json
|
||||||
|
BUILD=hugo
|
||||||
LEADERBOARD=/path/to/leaderboard.html
|
LEADERBOARD=/path/to/leaderboard.html
|
|
@ -98,6 +98,13 @@ Some utility commands:
|
||||||
Path to Hugo project where site rebuilds
|
Path to Hugo project where site rebuilds
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
build = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${pkgs.hugo}";
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
Build command
|
||||||
|
'';
|
||||||
|
};
|
||||||
guildData = lib.mkOption {
|
guildData = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
|
@ -113,7 +120,7 @@ Some utility commands:
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "network.target" ];
|
wantedBy = [ "network.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix \"${builtins.replaceStrings ["\""] ["\\\""] cfg.prefix}\" --hugo ${cfg.hugo} --guilds ${cfg.guildData}";
|
ExecStart = "${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix \"${builtins.replaceStrings ["\""] ["\\\""] cfg.prefix}\" --hugo ${cfg.hugo} --build \"${builtins.replaceStrings ["\""] ["\\\""] cfg.build}\" --guilds ${cfg.guildData}";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
|
@ -33,6 +33,8 @@ struct Arguments {
|
||||||
pub prefix: String,
|
pub prefix: String,
|
||||||
#[clap(long, help = "Path to Hugo project where site rebuilds")]
|
#[clap(long, help = "Path to Hugo project where site rebuilds")]
|
||||||
pub hugo: String,
|
pub hugo: String,
|
||||||
|
#[clap(long, help = "Build command", default_value = "hugo")]
|
||||||
|
pub build: String,
|
||||||
#[clap(long = "guilds", help = "Path to guild data JSON file", default_value = "guilds.json")]
|
#[clap(long = "guilds", help = "Path to guild data JSON file", default_value = "guilds.json")]
|
||||||
pub guild_data: String,
|
pub guild_data: String,
|
||||||
}
|
}
|
||||||
|
@ -44,6 +46,7 @@ impl Arguments {
|
||||||
discord_token: env::var("DISCORD_TOKEN")?,
|
discord_token: env::var("DISCORD_TOKEN")?,
|
||||||
prefix: env::var("PREFIX")?,
|
prefix: env::var("PREFIX")?,
|
||||||
hugo: env::var("HUGO")?.into(),
|
hugo: env::var("HUGO")?.into(),
|
||||||
|
build: env::var("BUILD")?,
|
||||||
guild_data: env::var("GUILD_DATA")?.into(),
|
guild_data: env::var("GUILD_DATA")?.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ pub fn to_fullwidth(string: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rebuild_site() {
|
pub fn rebuild_site() {
|
||||||
Command::new("./build.sh")
|
Command::new(&ARGS.build)
|
||||||
.current_dir(&ARGS.hugo)
|
.current_dir(&ARGS.hugo)
|
||||||
.status()
|
.status()
|
||||||
.expect("Failed to rebuild site");
|
.expect("Failed to rebuild site");
|
||||||
|
|
Loading…
Add table
Reference in a new issue