Skip to content

Commit

Permalink
Updated GitHub Actions config for testing without tagging.
Browse files Browse the repository at this point in the history
  • Loading branch information
drewzadev committed Nov 12, 2023
1 parent 3ccf097 commit 58df52f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 42 deletions.
2 changes: 1 addition & 1 deletion dist/rhel/s3-folder-sync-aarch64.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: s3-folder-sync
Version: 1.0.0
Version: 1.0.1
Release: 1
Summary: Syncronise a local folder with an S3 / Object Storage bucket.
Group: Applications/Tools
Expand Down
2 changes: 1 addition & 1 deletion dist/rhel/s3-folder-sync-x86_64.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: s3-folder-sync
Version: 1.0.0
Version: 1.0.1
Release: 1
Summary: Syncronise a local folder with an S3 / Object Storage bucket.
Group: Applications/Tools
Expand Down
81 changes: 42 additions & 39 deletions libs/configuration-manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ export default class ConfigurationManager {
this.delimiter = '\n'
}

returnAvailableConfigFilePath () {
if (fs.pathExists(this.localConfigFile)) {
return this.localConfigFile
} else {
if (fs.pathExists(this.mainConfigFile)) {
return this.mainConfigFile
} else {
return null
async returnAvailableConfigFilePath () {
const [localConfigError, localConfigResult] = await __(fs.pathExists(this.localConfigFile))
if (localConfigError) {
const [mainConfigError, mainConfigResult] = await __(fs.pathExists(this.mainConfigFile))
if (mainConfigError) {
throw new Error('Error: No config file found.')
}
return this.mainConfigFile
}
return this.localConfigFile
}

openFile (filePath) {
Expand Down Expand Up @@ -47,41 +47,44 @@ export default class ConfigurationManager {
}

async getConfig () {
const parser = new ConfigIniParser.ConfigIniParser(this.delimiter)
const configFilePath = this.returnAvailableConfigFilePath()
console.log('Info: Using config file: ' + configFilePath)
const parser = new ConfigIniParser.ConfigIniParser(this.delimiter)
const [configFilePathError, configFilePath] = await __(this.returnAvailableConfigFilePath())
if (configFilePathError) {
throw new Error(configFilePathError)
}
console.log('Info: Using config file: ' + configFilePath)

const [error, result] = await __(this.openFile(configFilePath))
if (error) {
throw new Error(error)
}
const [error, result] = await __(this.openFile(configFilePath))
if (error) {
throw new Error(error)
}

try{
parser.parse(result)
} catch (error) {
throw new Error(error.message)
}
try{
parser.parse(result)
} catch (error) {
throw new Error(error.message)
}

const pgpPassphrase = parser.getOptionFromDefaultSection('pgpPassphrase', 'null')
const bucketSecretKey = parser.getOptionFromDefaultSection('bucketSecretKey', 'null')
const bucketAccessKey = parser.getOptionFromDefaultSection('bucketAccessKey', 'null')
const bucketEndpoint = parser.getOptionFromDefaultSection('bucketEndpoint', 'null')
const bucketRegion = parser.getOptionFromDefaultSection('bucketRegion', 'null')

const pgpPrivateKeyArmored = parser.getOptionFromDefaultSection('pgpPrivateKeyArmored', 'null')
const pgpPublicKeyArmored = parser.getOptionFromDefaultSection('pgpPublicKeyArmored', 'null')

const finalConfig = {
pgpPassphrase,
bucketSecretKey,
bucketAccessKey,
bucketEndpoint,
bucketRegion,
pgpPrivateKeyArmored,
pgpPublicKeyArmored
}
const pgpPassphrase = parser.getOptionFromDefaultSection('pgpPassphrase', 'null')
const bucketSecretKey = parser.getOptionFromDefaultSection('bucketSecretKey', 'null')
const bucketAccessKey = parser.getOptionFromDefaultSection('bucketAccessKey', 'null')
const bucketEndpoint = parser.getOptionFromDefaultSection('bucketEndpoint', 'null')
const bucketRegion = parser.getOptionFromDefaultSection('bucketRegion', 'null')

const pgpPrivateKeyArmored = parser.getOptionFromDefaultSection('pgpPrivateKeyArmored', 'null')
const pgpPublicKeyArmored = parser.getOptionFromDefaultSection('pgpPublicKeyArmored', 'null')

const finalConfig = {
pgpPassphrase,
bucketSecretKey,
bucketAccessKey,
bucketEndpoint,
bucketRegion,
pgpPrivateKeyArmored,
pgpPublicKeyArmored
}

return finalConfig
return finalConfig
}

setConfigValue (parser, keyValues) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "s3-folder-sync",
"version": "1.0.0",
"version": "1.0.1",
"description": "s3 to local folder sync tool",
"main": "s3-folder-sync.js",
"scripts": {
Expand Down

0 comments on commit 58df52f

Please sign in to comment.