You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -103,6 +103,47 @@ function parseAwsCredentialsOrConfigFile(filecontents) {
103
103
}
104
104
}
105
105
106
+
/**
107
+
* Just creates an empty hyperform.json
108
+
* @param {string} absdir
109
+
*/
110
+
functioninitDumb(absdir,platform){
111
+
letjson
112
+
if(platform==='amazon'){
113
+
json={
114
+
amazon: {
115
+
aws_access_key_id: '',
116
+
aws_secret_access_key: '',
117
+
aws_region: '',
118
+
},
119
+
}
120
+
}elseif(platform==='google'){
121
+
json={
122
+
google: {
123
+
gc_project: '',
124
+
gc_region: '',
125
+
},
126
+
}
127
+
}else{
128
+
thrownewError(`platform must be google or amazon but is ${platform}`)
129
+
}
130
+
131
+
// append 'hyperform.json' to .gitignore
132
+
// (or create .gitignore if it does not exist yet)
133
+
fs.appendFileSync(
134
+
path.join(absdir,'.gitignore'),
135
+
`${EOL}hyperform.json`,
136
+
)
137
+
138
+
// write results to hyperform.json
139
+
fs.writeFileSync(
140
+
path.join(absdir,'hyperform.json'),
141
+
JSON.stringify(json,null,2),
142
+
)
143
+
log('✓ Created `hyperform.json` ')//
144
+
log('✓ Added `hyperform.json` to `.gitignore`')//
145
+
}
146
+
106
147
// TODO shorten
107
148
/**
108
149
* @description Tries to infer AWS credentials and config, and creates a hyperform.json in "absdir" with what it could infer. If hyperform.json already exists in "absdir" it just prints a message.
@@ -111,7 +152,7 @@ function parseAwsCredentialsOrConfigFile(filecontents) {
logdev(`Inferred AWS region from ${possibleConfigPath}`)
176
216
}else{
177
217
logdev(`Could not guess AWS region. No AWS config file found in ${possibleConfigPath}`)// TODO region will not be a single region, but smartly multiple ones (or?)
0 commit comments