mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
chore: add some documentation and somet testing
This commit is contained in:
@@ -1,33 +1,40 @@
|
||||
import { YAML } from "../dependencies.ts";
|
||||
import { ExpectedExports, Effects, Config, SetResult, DependsOn } from "../types.ts";
|
||||
import {
|
||||
Config,
|
||||
DependsOn,
|
||||
Effects,
|
||||
ExpectedExports,
|
||||
SetResult,
|
||||
} from "../types.ts";
|
||||
|
||||
/**
|
||||
* Will set the config to the default start9/config.yaml
|
||||
* @param effects
|
||||
* Assumption: start9/config.yaml is the location of the configuration
|
||||
* @param effects
|
||||
* @param newConfig Config to be written to start9/config.yaml
|
||||
* @param depends_on This would be the depends on for condition depends_on
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export const setConfig = async (
|
||||
effects: Effects,
|
||||
newConfig: Config,
|
||||
dependsOn: DependsOn = {}
|
||||
effects: Effects,
|
||||
newConfig: Config,
|
||||
dependsOn: DependsOn = {},
|
||||
) => {
|
||||
await effects.createDir({
|
||||
path: "start9",
|
||||
volumeId: "main",
|
||||
});
|
||||
await effects.writeFile({
|
||||
path: "start9/config.yaml",
|
||||
toWrite: YAML.stringify(newConfig),
|
||||
volumeId: "main",
|
||||
});
|
||||
await effects.createDir({
|
||||
path: "start9",
|
||||
volumeId: "main",
|
||||
});
|
||||
await effects.writeFile({
|
||||
path: "start9/config.yaml",
|
||||
toWrite: YAML.stringify(newConfig),
|
||||
volumeId: "main",
|
||||
});
|
||||
|
||||
const result: SetResult = {
|
||||
signal: "SIGTERM",
|
||||
"depends-on": dependsOn,
|
||||
};
|
||||
return { result, };
|
||||
const result: SetResult = {
|
||||
signal: "SIGTERM",
|
||||
"depends-on": dependsOn,
|
||||
};
|
||||
return { result };
|
||||
};
|
||||
|
||||
const _typeConversionCheck: ExpectedExports.setConfig = setConfig
|
||||
const _typeConversionCheck: ExpectedExports.setConfig = setConfig;
|
||||
|
||||
Reference in New Issue
Block a user