Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the setup script, capture only what is absolutely needed #576 #591

Merged
merged 11 commits into from
Sep 28, 2022

Conversation

nebs-dev
Copy link
Contributor

Resolves #576

  • Simplified setup script
  • Moved all env variables to one file in the root folder

@nebs-dev nebs-dev self-assigned this Sep 20, 2022
Copy link
Member

@kristoferlund kristoferlund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration from current setup needs to be handled:

  • Check if there are .env files in the package directories
  • If there are, merge those with the main .env, then delete them
  • Then load main .env
  • Start setup

);

const apiEnv = {
MONGO_INITDB_ROOT_USERNAME: randomString(12),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't generate random usernames for root username and username. Use the ones specified in .env.template


const apiEnv = {
MONGO_INITDB_ROOT_USERNAME: randomString(12),
MONGO_INITDB_ROOT_PASSWORD: randomString(12),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passwords should not be regenerated on each run

});
dotenv.config({ path: '/usr/praise/packages/frontend/.env', override: true });
dotenv.config({ path: '/usr/praise/.env.template', override: false });
dotenv.config({ path: '/usr/praise/.env', override: false });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Override should be true, right? The template should override any pre-existing env settings. And the "real" .env should override the template.

@@ -133,18 +125,30 @@ const questions = [
},
];

Copy link
Contributor Author

@nebs-dev nebs-dev Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because i wanted to use process env variable if exists. If not than we can build url depending on node env
And also i moved this to separate method because of SonarCloud was reporting code smell if we have nested conditionals

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.8% 1.8% Duplication

@kristoferlund kristoferlund merged commit c0e2ee4 into main Sep 28, 2022
@kristoferlund kristoferlund deleted the simplify_setup_script branch September 28, 2022 17:40
@kristoferlund kristoferlund mentioned this pull request Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify the setup script, capture only what is absolutely needed
2 participants