.env File
Env files are used to store credentials such as API keys, Firebase Credentials. An environment variable supports storing the API link at one location so that we do not need to change the Link in each file manually.
Environment variables is used to create clean and well-organized code with separating configuration from application logic, which yielding a codebase that's easier to maintain, read and debug.
Is a .env file secure?
-: env file is a good way to keep it secure and separate from the rest of your code. Defining your API key in a .env file has several benefits: Security: Keeping your API key in a separate file ensures that it does not get accidentally committed to a public repository.
Where should .env file go in the project?
-: Open the project root directory and create a .env file inside that directory.
How can use .env files?
Default we have set fake-backend authentication in this template. You can simply
change
to firebase or fakebackend by changing in .env
file.
Fake-backend : VUE_APP_DEFAULT_AUTH=fakebackend
To setup firebase authentication fill the below details in the .env
file.
Firebase : VUE_APP_DEFAULT_AUTH=firebase
VUE_APP_URL= "YOUR_API"
VUE_APP_I18N_LOCALE=en
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_DEFAULT_AUTH=firebase
VUE_APP_APIKEY=
VUE_APP_AUTHDOMAIN=
VUE_APP_DATABASEURL=
VUE_APP_PROJECTId=
VUE_APP_STORAGEBUCKET=
VUE_APP_MESSAGINGSENDERID=
VUE_APP_APPId=
VUE_APP_MEASUREMENTID=
How to create subdirectory build?
-: To create a subdirectory named build, you can specify the desired public URL for
your
project within the .env file by setting the publicPath
. This
configuration
will
effectively generate the build subdirectory for your project. Additionally, the
publicPath
will
provide access to the project from the vue.config.js
file.
publicPath: '/skote/vuejs/v-light/'
These environment variables will be defined for you on process.env.
The
below example for
process.env is from src/router/index.js
file.
const router = createRouter({
history: createWebHistory('/skote/vuejs/v-light/'),
... // your code here
});
Env files are used to store credentials such as API keys, Firebase Credentials. An environment variable supports storing the API link at one location so that we do not need to change the Link in each file manually.
Environment variables is used to create clean and well-organized code with separating configuration from application logic, which yielding a codebase that's easier to maintain, read and debug.
Is a .env file secure?
-: env file is a good way to keep it secure and separate from the rest of your code. Defining your API key in a .env file has several benefits: Security: Keeping your API key in a separate file ensures that it does not get accidentally committed to a public repository.
Where should .env file go in the project?
-: Open the project root directory and create a .env file inside that directory.
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:IKhrcDxGHORbzZbJXI1qHPCFtQcIaoFoyYgyVHy7pLQ=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=skote_laravel_vue
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"