Skip to content

Instantly share code, notes, and snippets.

@k-oguma
Last active December 2, 2018 21:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k-oguma/b9270508ceab28e7a8967eb121e17244 to your computer and use it in GitHub Desktop.
Save k-oguma/b9270508ceab28e7a8967eb121e17244 to your computer and use it in GitHub Desktop.
Cloud9 settings. init script, user setting, project setting
# AWS Cloud9 settings
## Prepare
### AWS SSM
Push the your environment variables.
- FYI
- Like a [12 factor app](https://12factor.net/config)
e.g, GITHUB_TOKEN=XXXXXXXXXXXX
```
aws ssm put-parameter --name GITHUB_TOKEN --type SecureString --value XXXXXXXXXXXX
```
// You can access plugins via the 'services' global variable
/*global services, plugin*/
// Warning: Using this initialization script to load third-party plugins by
// using loadPackage into the AWS Cloud9 IDE is currently not officially
// supported. If you attempt to load third-party plugins into the AWS Cloud9
// IDE, you do so at your own risk. Third-party plugins can have full access
// to all of your AWS Cloud9 environments, including their source code, AWS
// credentials if present, and various other settings and files. We cannot
// provide support for using third-party plugins, and we reserve the right to
// disable this functionality at any time.
/*
My credential setup into a ~/.bash_profile at using the environment variable.
Also other setting too. e.g, golang environment setup etc.
This init.js does execute before loading ~/.bash_profile.
*/
"use strict";
console.log("begin init script");
var fs = services["fs"];
const writeFilePath = "~/.bash_profile";
const setupProfile = `# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
source $HOME/.nvm/nvm.sh
export GOROOT="/usr/local/go"
export GOPATH="/home/ec2-user/go"
# environment variable. (e.g, GITHUB_TOKEN)
export GITHUB_TOKEN=$(aws ssm get-parameter --name GITHUB_TOKEN --query Parameter.Value --output text --with-decryption)
`;
fs.writeFile(writeFilePath, setupProfile, 'utf8',
function(err, success) {
if (err) {
services["dialog.alert"].show(
"Error",
"File Write Operation",
"Could not write file '" + writeFilePath + "'."
);
} else {
services["dialog.alert"].show(
"Success",
"File Write Operation",
"Wrote file '" + writeFilePath + "'."
);
}
}
);
{
"run": {
"configs": {
"json()": {},
"@inited": true
}
},
"language": {
"tern_defs": {
"json()": {
"ecma5": {
"enabled": true
},
"jQuery": {
"enabled": true
},
"browser": {
"enabled": true
}
}
}
},
"welcome": {
"@first": true
},
"instance": {
"@automaticShutdown": "30"
},
"general": {
"@stripws": true
},
"aws": {
"@awsRegion": "ap-northeast-1"
}
}
{
"ace": {
"@keyboardmode": "vim",
"@showGutter": true,
"@theme": "ace/theme/tomorrow_night",
"statusbar": {
"@show": true
},
"custom-types": {
"json()": {
"settings": "javascript"
}
},
"@showInvisibles": true,
"@behavioursEnabled": true,
"@wrapBehavioursEnabled": true
},
"build": {
"@autobuild": false
},
"collab": {
"@timeslider-visible": false
},
"debug": {
"@autoshow": true,
"@pause": 0
},
"general": {
"@propose": "",
"@skin": "dark",
"@revealfile": true
},
"openfiles": {
"@show": false
},
"output": {
"@backgroundColor": "#003a58",
"@foregroundColor": "#FFFFFF",
"@selectionColor": "#225477"
},
"projecttree": {
"@showhidden": false
},
"tabs": {
"@show": true
},
"terminal": {
"@antialiasedfonts": true,
"@backgroundColor": "#153649",
"@foregroundColor": "#FFFFFF",
"@selectionColor": "#515D77",
"@scrollback": 10000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment