-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove provider and config.yml support
- Loading branch information
Showing
19 changed files
with
44 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,5 @@ Usage | |
:maxdepth: 1 | ||
|
||
commandline_interface | ||
global_options | ||
examples | ||
example2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,10 @@ | ||
import { fileURLToPath } from 'url' | ||
import { dirname } from 'path' | ||
import path from 'path' | ||
import os from 'os' | ||
import fs from 'fs' | ||
import YAML from 'js-yaml' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
|
||
interface Config { | ||
provider: string | ||
providerDir: string | ||
} | ||
|
||
const homedir = os.homedir() | ||
const defaultProvider = 'default' | ||
|
||
const configDir = path.join(homedir, '.charites') | ||
fs.mkdirSync(configDir, { recursive: true }) | ||
|
||
const configFile = path.join(configDir, 'config.yml') | ||
let config: Config = { provider: '', providerDir: '' } | ||
|
||
try { | ||
const yaml = fs.readFileSync(configFile, 'utf-8') | ||
config = YAML.load(yaml) as Config | ||
} catch (_) { | ||
// nothing to do | ||
} | ||
|
||
export const defaultValues: Config = { | ||
provider: config.provider || defaultProvider, | ||
providerDir: path.join(path.dirname(path.dirname(__dirname)), 'provider'), | ||
} | ||
|
||
export const defaultSettings = { | ||
configFile: configFile, | ||
} | ||
export const providerDir = path.join( | ||
path.dirname(path.dirname(__dirname)), | ||
'provider', | ||
) |
Oops, something went wrong.