Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
fix: readfilesync not working with function
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcodercrane committed Aug 2, 2023
1 parent e5d3643 commit 09044eb
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 59 deletions.
48 changes: 0 additions & 48 deletions .github/ubiquibot-config-default.yml

This file was deleted.

15 changes: 4 additions & 11 deletions src/utils/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import {
getRegisterWalletWithVerification,
} from "./helpers";

import DEFAULT_CONFIG_JSON from "../../ubiquibot-config-default.json";

const CONFIG_REPO = "ubiquibot-config";
const CONFIG_PATH = ".github/ubiquibot-config.yml";
const DEFAULT_CONFIG_PATH = ".github/ubiquibot-config-default.yml";
const DEFAULT_CONFIG_PATH = "/ubiquibot-config-default.yml";
const KEY_NAME = "private-key-encrypted";
const KEY_PREFIX = "HSK_";

Expand Down Expand Up @@ -85,11 +87,6 @@ export const parseYAML = (data?: string): WideConfig | undefined => {
}
};

export const getDefaultConfig = (): WideRepoConfig => {
const defaultConfig = readFileSync(`${__dirname}/../../ubiquibot-config-default.yml`, "utf8");
return parseYAML(defaultConfig) as WideRepoConfig;
};

export const getPrivateKey = async (cipherText: string): Promise<string | undefined> => {
try {
await _sodium.ready;
Expand Down Expand Up @@ -136,11 +133,7 @@ export const getWideConfig = async (context: Context) => {

const parsedOrg: WideOrgConfig | undefined = parseYAML(orgConfig);
const parsedRepo: WideRepoConfig | undefined = parseYAML(repoConfig);
const defaultConfig = await getConfigSuperset(context, "repo", DEFAULT_CONFIG_PATH);
const parsedDefault: WideRepoConfig | undefined = parseYAML(defaultConfig);
if (!parsedDefault) {
throw new Error("Default configuration missing!");
}
const parsedDefault: WideRepoConfig = DEFAULT_CONFIG_JSON;
const privateKeyDecrypted = parsedOrg && parsedOrg[KEY_NAME] ? await getPrivateKey(parsedOrg[KEY_NAME]) : undefined;

const configs = { parsedRepo, parsedOrg, parsedDefault };
Expand Down
68 changes: 68 additions & 0 deletions ubiquibot-config-default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"evm-network-id": 100,
"price-multiplier": 1.5,
"issue-creator-multiplier": 2000,
"time-labels": [
{
"name": "Time: <1 Hour",
"weight": 0.125,
"value": 3600
},
{
"name": "Time: <1 Day",
"weight": 1,
"value": 86400
},
{
"name": "Time: <1 Week",
"weight": 2,
"value": 604800
},
{
"name": "Time: <2 Weeks",
"weight": 3,
"value": 1209600
},
{
"name": "Time: <1 Month",
"weight": 4,
"value": 2592000
}
],
"priority-labels": [
{
"name": "Priority: 0 (Normal)",
"weight": 1
},
{
"name": "Priority: 1 (Medium)",
"weight": 2
},
{
"name": "Priority: 2 (High)",
"weight": 3
},
{
"name": "Priority: 3 (Urgent)",
"weight": 4
},
{
"name": "Priority: 4 (Emergency)",
"weight": 5
}
],
"default-labels": ["Time: <1 Hour", "Priority: 0 (Normal)", "Test"],
"auto-pay-mode": true,
"disable-analytics": true,
"comment-incentives": false,
"max-concurrent-assigns": 2,
"comment-element-pricing": {
"text": 0.1,
"link": 0.5,
"list": 0.5,
"code": 5,
"image": 5
},
"promotion-comment": "\n<h6>If you enjoy the DevPool experience, please follow <a href='https://github.com/ubiquity'>Ubiquity on GitHub</a> and star <a href='https://github.com/ubiquity/devpool-directory'>this repo</a> to show your support. It helps a lot!</h6>",
"register-wallet-with-verification": false
}

0 comments on commit 09044eb

Please sign in to comment.