Skip to content

Commit 8ffb45d

Browse files
author
Marco Franceschi
committed
chore: Moved default cg config to constants file
1 parent 4813b16 commit 8ffb45d

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/commands/policy/add.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
import { PluginType } from '@cloudgraph/sdk'
22
import { isEmpty, uniqBy } from 'lodash'
3+
import { DEFAULT_CG_CONFIG } from '../../utils/constants'
34

45
import OperationBaseCommand from '../operation'
56

6-
const defaultCGConfig = {
7-
cloudGraph: {
8-
plugins: {},
9-
storageConfig: {
10-
host: 'localhost',
11-
port: '8997',
12-
scheme: 'http',
13-
},
14-
versionLimit: 10,
15-
queryEngine: 'playground',
16-
port: '5555',
17-
},
18-
}
19-
207
export default class AddPolicy extends OperationBaseCommand {
218
static description = 'Add new policy packs'
229

@@ -42,7 +29,7 @@ export default class AddPolicy extends OperationBaseCommand {
4229
} = installedPolicy
4330

4431
// Save policy to CG config file
45-
const config = this.getCGConfig() || defaultCGConfig
32+
const config = this.getCGConfig() || DEFAULT_CG_CONFIG
4633
let configuredPolicies =
4734
config.cloudGraph.plugins?.[PluginType.PolicyPack] || []
4835
if (isEmpty(configuredPolicies)) {

src/utils/constants.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ export const messages = {
2525
plural: 'providers',
2626
},
2727
}
28+
29+
export const DEFAULT_CG_CONFIG = {
30+
cloudGraph: {
31+
plugins: {},
32+
storageConfig: DEFAULT_CONFIG,
33+
versionLimit: 10,
34+
queryEngine: 'playground',
35+
port: '5555',
36+
},
37+
}

0 commit comments

Comments
 (0)