Categories
Web Development Web Security

How to permanently set Linux environmental variablees

Every time I need to set Linux Environment variables and I use google to find out how, I always end up with those VALUELESS posts that tell you to use a terminal with export blah blah blah. Then when I close the terminal and try to use a variable it doesn’t exist and I am like WTF. Well those posts are how to set a temporary environmental variable.

This post covers what I always google and get the failed results for. This post is how to permanently forever set environmental variables.  This is often needed for development to store sensitive api key secrets, passwords etc. You should never put any of that information in a file for your project.

The idea is to create environmental variables to hold this info on your local machine, then when you put your code into production you add the necessary environmental variables to whatever controls them for your app. You can use kubernetes secrets or Hashicorp vault or if you are using something like Gitlab or Openshift continuous integration/delivery pipeline workflow will have a way to enter these values securely.

But here is how you set your local linux environment variables permanently. There are many ways to set these variables, here is a great article covering the topic.

But none of that above is useful to use, nope not for what we want to do. I just got a cool idea, rant/WOULDN’T IT BE COOL IF YOU COULD SET ENVIRONMENTAL VARIABLES IN MORE WAYS WITH LINUX. I mean where is the fun in only having 1 maybe 2 good ways of doing something, lets add more and more and more./rant

Ok so all of that sucks, how can we truly set environmental variables for our Development environment in a way that is easy and safe? Magic that is how.   Actually what you do is create a file with all of the secrets your app needs for development testing as environmental variables. I had to search hard and long to figure this out.

You create a file with any name you want with extension .sh like example-app.sh As described in the link above Linux will read all of the files in that directory and create the environmental variables. Hours of digging to figure that simple trick out FFS.

This is basically what I have in a simple text file

You simply add a new line for each variable you want to have created for your app.

Categories
medicine Resources

Articles resources and information about intelligence

Research study explains why highly intelligent people prefer to be alone

What is the purpose of Theta brain waves – people with ADHD have increase Theta wave production. But what are theta waves?

Categories
Resources Web Development

Serverless computing resources

Economics of serverless – a great article if you are interested in going serverless.

Categories
medicine Science

Articles about genetics

Gene swapping – an article about how all organisms naturally get genes from other non related organisms such as bacteria. Very interesting article.

Expression of multiple horizontally acquired genes is a hallmark of both vertebrate and invertebrate genomes – research paper

Categories
Random Resources

Link to Doctrine annotations list

This post is because I will never remember how I found this link to the list of annotations for doctrine.

Doctrine Annotations list

Categories
Random Resources Web Development

PHP random links and resources

PHP the Right way – a website/book full of the most useful information you will find about PHP

Categories
Resources Web Development

PHP Namespace information, links and resources

It is important to understand what namespaces are in PHP and how to use them. Otherwise you will be lost and have many pains.

Videos

Below is a series of great videos explaining PHP namespaces little by little in easy to find and digest chunks.\
PHP namespaces 1/10: What is a namespace in PHP?









Everything about PHP namespaces – OOP in PHP | Part 10

Categories
Resources Web Security

Docker resources

Links, resources and videos about Docker in specific.

Manage sensitive data with Docker secrets – information from the documentation about using docker secrets. Secrets are for managing things like database passwords and other passwords.

Introducing docker secrets management – an article explaining what Docker secretes management is and it’s value.

Categories
Resources Web Development

How to output Symfony environmental variables

I couldn’t remember where the hell I had seen this in the documentation so I am linking to it here. Why?

Because it absolutely isn’t where you would expect it to be like listed under Environmental variables. Hell no why list that shit there that’s all logical and shit.

It is actually under configuration all the way to the bottom under “List environment variables.” Would be so nice if that was in the Enironmental Variables page instead or a link to it or mention of it.

Categories
Resources Web Security

Symfony doctrine database secret configuration links and resources.

Storing secrets for Symfony applications – some ideas how to approach the topic