Skip to content

Commit 6e44855

Browse files
committed
hide messages for CLI
1 parent 2222822 commit 6e44855

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/lib/HAXCMS.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,13 +1793,16 @@ class HAXCMSClass {
17931793
this.superUser = {...this.user};
17941794
}
17951795
catch (e) {
1796-
console.warn('***************************************************************');
1797-
console.warn('\nHAXcms USER CONFIGURATION FILE NOT FOUND, creating default user');
1798-
console.warn(`${path.join(this.configDirectory, ".user")} is being created with default credentials`);
1799-
console.warn("MAKE SURE YOU EDIT THIS FILE IF PUTTING IN PRODUCTION!!!!!");
1800-
console.warn("username: admin");
1801-
console.warn("password: admin");
1802-
console.warn("\n***************************************************************");
1796+
// don't send console warnings if this is CLI
1797+
if (!this.isCLI()) {
1798+
console.warn('***************************************************************');
1799+
console.warn('\nHAXcms USER CONFIGURATION FILE NOT FOUND, creating default user');
1800+
console.warn(`${path.join(this.configDirectory, ".user")} is being created with default credentials`);
1801+
console.warn("MAKE SURE YOU EDIT THIS FILE IF PUTTING IN PRODUCTION!!!!!");
1802+
console.warn("username: admin");
1803+
console.warn("password: admin");
1804+
console.warn("\n***************************************************************");
1805+
}
18031806
// create a default user
18041807
this.superUser = {
18051808
name: 'admin',
@@ -1811,8 +1814,8 @@ class HAXCMSClass {
18111814
};
18121815
fs.writeFileSync(path.join(this.configDirectory, ".user"), JSON.stringify(this.user, null, 2));
18131816
}
1814-
// warn if we have default credentials
1815-
if (this.user.name == 'admin' && this.user.password == 'admin') {
1817+
// warn if we have default credentials unless CLI
1818+
if (this.user.name == 'admin' && this.user.password == 'admin' && !this.isCLI()) {
18161819
console.warn('***************************************************************');
18171820
console.warn('\nHAXcms USER CONFIGURATION FILE HAS DEFAULT CREDENTIALS, change them!!');
18181821
console.warn(`\n${path.join(this.configDirectory, ".user")}`);

0 commit comments

Comments
 (0)